PDA

View Full Version : How to copy files using SSH


Dragon Lord 2040
10-12-2004, 12:51 PM
When SSH into a computer, how do you copy files from the computer your login into, to the computer your physically at?

vancenase
10-12-2004, 02:09 PM
you can't copy using the 'ssh' program specifically, but you can with it's associated programs: sftp or scp

sftp is (and works) similar to ftp

scp is a neat little program:


copy from a remote machine to my machine:
scp user@192.168.1.100:/home/remote_user/Desktop/file.txt /home/me/Desktop/file.txt

copy from my machine to a remote machine:
scp /home/me/Desktop/file.txt user@192.168.1.100:/home/remote_user/Desktop/file.txt

copy all file*.txt from a remote machine to my machine (file01.txt, file02.txt, etc.; note the quotation marks:
scp "user@192.168.1.100:/home/remote_user/Desktop/file*.txt" /home/me/Desktop/file.txt

copy a directory from a remote machien to my machine:
scp -r user@192.168.1.100:/home/remote_user/Desktop/files /home/me/Desktop/.



see 'man scp' or 'man sftp' for more ...

hopefully there are no typos! :)

Anticipat3
10-14-2004, 01:56 PM
instead of using some of the clunky command line ftp utilities (which work, mind you, but are crappy for working with a lot of files), if you're already running sshd ("remote login") service on the box you're remotely logging into, you could also enable ftp access, and then use a graphical SFTP client to access the files (Fugu is a great one.)

trevor
10-14-2004, 02:48 PM
if you're already running sshd ("remote login") service on the box you're remotely logging into, you could also enable ftp access, and then use a graphical SFTP client to access the files (Fugu is a great one.)

If you are already running sshd on a computer (Remote Login in System Preferences > Sharing > Services), then you can already use a graphical sftp client such as fugu from a remote computer to access the files. It is NOT a good idea to also turn on ftp, which is unrelated and insecure.

If the computer running Remote Login is behind a NAT router, and the remote computer is not on the LAN, you will need to forward port 22 on the router to port 22 on the computer. If the computer running Remote Login has a routable IP and is therefore exposed to the internet, this is not necessary.

Trevor

froinds
10-14-2004, 05:11 PM
You forgot to mention that scp would leave his poor resource forks behind.

trevor
10-14-2004, 06:08 PM
...as would sftp. If copying files with resource forks, you should probably flatten them before copying across the network.

Trevor

ElectusUnum
10-15-2004, 01:20 AM
Don't forget the SFTP gui frontend called "Fugu" for os x.
http://rsug.itd.umich.edu/software/fugu/
It's opensource too.

vancenase
10-15-2004, 09:07 AM
You forgot to mention that scp would leave his poor resource forks behind. oops, i blame that on my own uses ... i usually transfer files that do not have resource forks ...

when do you think the resource spork (http://members.tripod.com/~sporkk/) will be developed?