Click to See Complete Forum and Search --> : Secure copy between computers without a password


Syngin
09-14-2005, 10:59 AM
How to set up a secure copy without a password:
Let us assume that you are setting up a secure copy tunnel between 2 machines: local and remote. The first thing to do is ensure that ssh and openssl are installed. For our purpose, the local machine is the machine doing the copying to the remote host.

Local machine setup:

1. cd into the .ssh directory in your users home directory (ie. cd /home/syngin/.ssh)(If this directory doesn’t exist yet, try ssh-ing into the remote host from the command line and it should be created for you)

2. ssh-keygen –t rsa (This might ask some strange questions. Be sure to choose no passphrase. Two files will be created: id_rsa and id_rsa.pub)

3. scp id_rsa.pub user@remote-host.com:.ssh/authorized_keys (This will copy your public key to the remote host)(You may be prompted for the remote user’s password)

4. Test for success: ssh user@remote-host.com You should now be logged in without a password.

Remember that this is valid for user to user only so make sure you set up any automated copying in the specific user’s crontab.

Anyone have any additions to this or error corrections? I've done this on both Redhat and Debian servers.

je_fro
09-14-2005, 01:40 PM
what's in your /etc/ssh/sshd_config ?

Syngin
09-14-2005, 02:47 PM
Well, the user on the remote system would have to have SSH priviledges.

This worked with an out-of-the-box ssh setup on both Redhat and Debian though.

bwkaz
09-14-2005, 06:45 PM
Be sure to choose no passphrase. ACK! :p

I would say that you definitely want a passphrase. If you don't want to constantly re-type the passphrase, then look into ssh-agent and ssh-add -- ssh-agent will (attempt to) securely store your unencrypted private key in memory. ssh-add is what you use to tell ssh-agent "here's a new private key". You only type in the passphrase when you do the ssh-add.