scp without password… passwordless scp

How to transfer files using scp without a password (secure copy):

1) On the Source Host run the following command as the user which will be scping the files to the remote host:
*** leave the paraphrase blank

ssh-keygen -t rsa

2) Once the key has been generated copy the id_rsa.pub to the remote-host machine you are scping to:

scp id_rsa.pub <user-name>@<remote-host>:/<remote-directory>

EXAMPLE:
scp id_rsa.pub [email protected]_host:/home/joe/

3) Now on the remote-host you need to add the ida_rsa.pub to the authorized_keys file (located /home/<user>/.ssh/). if the
directory does not exist create it (this assumes you are in the users home directory, an “ls -la” will show all files and directories in the current directory – including the hidden ones, which the .ssh is)

mkdir .ssh (IF NEEDED – must be in the /home/<user-name>)

cat ida_rsa.pub >> .ssh/authorized_keys
chmod –recursive 700 .ssh/

4) Try copying a file to the remote-host, you should not need to enter the password. MAKE SURE NO ONE GETS A HOLD OF THE KEY you made.

scp <some-file.txt> <user>@<remote-host>:/<some_directory>

One thought on “scp without password… passwordless scp

  1. Pingback: How To: Bash Backup Script « Skrakes.com

Leave a Reply

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

*