Linux

Copying files from remote server via scp

I have done copying files and even directories from remote servers before. However, this time it is more secure and password is not visible on the command line. Moreover, the file transfer goes through secure medium SSH.

Nothing fancy, this is how we do it.

scp user@server.net:file-under-user-home-dir.txt copied-file.txt
scp user@server.net:dir-under-user-home-dir/some/file.txt /full/path/to/destination/file.txt
scp user@server.net:/var/www/vhosts/somesite.com/backup.tar.gz .
scp -r user@server.net:/var/www/vhosts/somesite.com/images .
scp -r user@server.net:/var/www/vhosts/somesite.com/images /home/user/backup/sometime.com/images

In all these operations, the user is prompted to enter the password.

2 thoughts on “Copying files from remote server via scp”

  1. I use scp all the time. It’s very useful when it’s written in bash scripts by automating upload and download of remote files.

  2. Yes it is, although a bit slower due to the additional security layer.

    Thanks for visiting Sir Jed.

Leave a reply

Your email address will not be published. Required fields are marked *