Using SCP with keys

The command to send a file to your remote server, using ssh keys, is (assuming you accepted the default name for your ssh key upon creation):

scp -i ~/.ssh/id_rsa.pub Filetomove USER@SERVER:/home/YourUSER/Filetomove

Where Filetomove is the name of the file, USER is your username on the remote machine, and SERVER is the address of the remote server.

You should be prompted for the ssh key password if there is one(not the user password). Once authenticated, the file will be transferred.

The same procedure will work if you need to pull a file from a remote server. The structure of that command would be:

scp -i ~/.ssh/id_rsa.pub USER@SERVER:/home/USER/Filetomove /home/USER/Filetomove

If there is one, you will be asked for your ssh key password (if you set one up), and the file will be pulled from the server and copied to the local machine.

Similar Posts

Leave a Reply