How to copy files using SSH

FREQUENTLY ASKED QUESTIONS
Q: How to copy files using SSH or via putty ?   (Linux)


           To copy files/directories over secure shell SCP command is used. SCP (Secure Copy) provides secure file transfer between machines. and also features encryption while transfer. This cause little bit slow than regular ftp and other protocols.


Copy a file from remote linux machine to local machine
#scp user@192.168.10.20:/home/user/Documents/new.txt /home/new/Desktop/
user@192.168.10.20's password:     (now input password of user)
new.txt                                   100%  794     0.8KB/s   00:00
#The above command copies the file "new.txt" from the remote system(ip=192.168.10.20) to Desktop


 Copy a file from local machine to remote linux machine.

[root@server ~#]scp /new/Doc/new.txt  james@192.168.10.20:/home/james/Desktop/
james@192.168.10.20's password:     (now input the password of james)
new.txt                                   100%  324     0.8KB/s   00:00
#The above command copies the file "new.txt" from the local machine to  remote system with ipaddress 192.168.10.20.
Note: If the username is not specified in the command, you will have to enter the root password of the remote machine. Can also transfer directories In the same way. 

How to Specify Port Numbers with SCP
         If the remote SSH server listens on a diffrent port than default 22/TCP. Then pecify that port number by using the " -P " switch. 
#scp -P 353 user@192.168.10.20:/home/user/Documents/new.txt /home/james/Desktop/
In the above command the remote servers(192.168.10.20) ssh port is 353/TCP

1 comments:

Chan PK said...

This is the simplest, clearest explanation of this topic I have found. Thanks!
linux scp

Related Posts Plugin for WordPress, Blogger...

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost Coupons