Skip to content

Using SCP, the complement of SSH to transfer files and folders

Now we discuss how we can use a tool called SCP that comes with the SSH to transfer files and directories:SCP mean Secure CthePand a leg over SSH, for transferring files or folders between computers. The syntax is simple:

$ scp archive user@servidor.com:route

And to copy the reverse, from the remote computer to yours, you just have to reverse the order of the elements:

$ scp user@servidor.com:path /archive ruta_local

So for example, if we send something to the server:

$ scp Hello.txt tomas@bootlog.cl:/www / site

Send the file Hello.txt and leave it in the folder /www / site on the server bootlog.cl. You can also send entire folders (with -r):

$ scp -r viajealsur / tomas@bootlog.cl:/www / site / photos

So send the folder /viajealsur complete /www / site / photos.

Now, the same process in reverse would be:

$ scp -r tomas@bootlog.cl:/www / site / images / viajealsur ~

This would copy the folder viajealsur/ the server to my folder /home.

Ah, Folders purpose ya man, as SCP (and SSH) The default path is your user folder, if you want to copy something to or from there, You can omit the path:

$ scp bootlog.cl song.mp3:

In this case the syntax is well, since my user is called 'take' on both sides, so I have to type it again, and as I am copying the file song.mp3 my user folder, I can also omit the path.

Now it's time for you to do the test. Remember to install the openssh-server on the remote PC to connect

Source: http://pintucoperu.wordpress.com/2007/11/27/como-usar-scp-el-complemento-de-ssh-para-transmitir-archivos-y-carpetas/