how do I scp a file - Printable Version +- Linux-Noob Forums (https://www.linux-noob.com/forums) +-- Forum: Linux Server Administration (https://www.linux-noob.com/forums/forum-8.html) +--- Forum: Remote Access (https://www.linux-noob.com/forums/forum-88.html) +--- Thread: how do I scp a file (/thread-1577.html) |
how do I scp a file - anyweb - 2007-02-27 first of all what is scp ? here's a quote direct from the top of the command Code: man scp Quote:SCP(1) BSD General Commands Manual SCP(1) it's the same as cp (copy) except secure as you are doing it over an ssh connection. When you start an scp session to a target box, you will be prompted for the users ssh password, this is normal and signifys to you that this is a secure transfer. here's the usage Code: scp -prP port file user@ip:./ where port=the ssh listening port on the target linux box where file=the file you want to send to the target where user=the username you ssh in as where ip=the ip address of the target box where :./=the home directory of the user you are ssh'ing as and -p =Preserves modification times, access times, and modes from the original file. -P=capital P for port as -p is already taken from above. -r=recursively copy entire directories. so a real example of the above would be like Quote:[anyweb@localhost ~]$ scp -prP 1234 SC_160_P_ESD1.zip anyweb@213.64.12.34:./anyweb@213.64.12.34's password: thanks to P38 and jY for the advice. cheers anyweb how do I scp a file - linuxRon - 2009-03-22 if you need some more scp examples how do I scp a file - Dungeon-Dave - 2009-03-31 I'd also add that another option is to use the "sftp" command. Essentially a FTP-like interactive shell but utilising SSH. I find SCP is good for copying one or two files, but SFTP is easier for yanking several at a time (such as an entire directory). Also check out "rsync" for keeping a mirrored server up to date with its original data. how do I scp a file - anyweb - 2009-04-01 feel free to give us some examples of doing this, i must confess to using the scp method quite a bit but any cli alternative is appreciated :) how do I scp a file - Dungeon-Dave - 2009-04-01 In its simplest form, use: Code: sftp remote.host To use a different username: Code: sftp fred@remote.host To use other SSH options, such as specifying a different SSH port number: Code: sftp -oPort=65422 fred@remote.host Once connected, use "help" at the prompt for assistance: Code: sftp> help Many FTP commands work in SFTP: "cd" to change directory on remote host "lcd" to change local directory (useful if you started the SFTP session in the wrong directory!) "get myfile" to download that file from remote host to local directory "put newfile" to upload a local file to the remote host "mget *.txt" to download all files matching that pattern (shell globbing expression, not regular expression) Hope that's enough to go on! |