transfering files through ssh

August 28th, 2006 mysurface Posted in Admin, scp | Hits: 70657 | 7 Comments »

As long as you can access a site with ssh account, then you can transfer files using scp, try to imagine , you are from host A and you have access to host B through ssh with same user account call foobar. You can copy a file from host B by example as bellow

scp foobar@hostB:~/myfile.txt .

:~/ actually leads you to home directory of foobar, as long as the file is accessible by the account foobar in host B, than it can be transfer. The other way round is transfer file from host A to host B.

scp myfile.txt foobar@hostB:~/

It support to copy a folder from one host to another by adding option -r

scp -r foobar@hostB:~/myfolder .

Copy from one host to another with different ssh account.

scp foobar@hostB:~/myfile.txt root@hostF:~/

7 Responses to “transfering files through ssh”

  1. [...] If you want to transfer one or few files which you have know the location, scp would be enough. SCP example will be here. But if do not know the location of the file, and you want to login to browse the directories? consider sftp. Login to sftp is like login to ssh, sftp foobar@192.167.8.9 [...]

  2. [...] zssh, ZModem ssh, an alternative way to ssh and scp? To perform file transfer and ssh in ordinary way you need ssh and scp. [...]

  3. thanks a lot, it’s the last i need know for manage my server

    :D

  4. Cool! thanks

  5. Consider using rsync. It supports ssh and remote sources, but it uses a lot less bandwidth only transferring what needs to be changed rather than everything like scp.
    You need rsync on both servers, however.

  6. good one!!
    makes my life easier

  7. I would like to thank you for the efforts you have put in writing this web site. I am hoping the same high-grade blog post from you in the upcoming as well. In fact your creative writing skills has inspired me to get my own website now. Really the blogging is spreading its wings rapidly. Your write up is a great example of it.

Leave a Reply