Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I can copy the rsa key to the remote server for passwordless log-in. But I was told that there is another way to add this functionality using ssh-agent. I have run the commands generated by ssh-agent command. I did tried to add the key using ssh-add

$ ssh-add
Enter passphrase for /home/shantanu/.ssh/id_dsa: 
Identity added: /home/shantanu/.ssh/id_dsa (/home/shantanu/.ssh/id_dsa)

Does ssh-agent work the way I am trying to make it work?

share|improve this question
    
Are you talking about sshing from client to server without a password, or sshing from client to server 1, then sshing from server 1 to server 2 without a password? –  DerfK Aug 27 '11 at 20:27
add comment

3 Answers

up vote 0 down vote accepted

The reason why you want this is propably because you want to do something automated on a remote server. Using ssh-agent or something similar is possibly no option, since you have to input the passphrase in an automated way, too.

Using keys without passphrase will do the job, but that is dangerous. So if you do it without passphrase:

  • Don`t use a priviledged account
  • You can limit the action to a single command in the authorized_keys file
  • If you need to copy things: Use a transfer account and use another local account to get the data from the transfer acccount
share|improve this answer
add comment

Here is a great tutorial on setting passwordless login properly explaining a lot of details.

share|improve this answer
add comment

If your key has no passphrase (usually a bad thing) you don't need ssh-agent. You just put the public key into the authorized_keys file and off you go.

If however, your key does have a passphrase then you use ssh-agent (as well as putting the public key into the authorized_keys file), add the passphrase once (as you did above), and then for the rest of that session you don't have to use it again. For a new session you will have to add it again, this is usually a minor inconvenience.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.