Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This question already has an answer here:

Is there a way to store my password when ssh'ing on a server? I tried to change the variables BatchMode and PasswordAuthentication in my file /etc/ssh/ssh_config, but to no avail. Could someone indicate me how to proceed?

share|improve this question

marked as duplicate by Thomas Nyman, Anthon, Zelda, slm, rahmu Jan 13 at 16:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
There has to be some form of authentification -- you can't have none, although empty passwords would be close to that. I recommend you use keys, as Patrick suggests, and then look at ssh-agent, a keyring for ssh mentioned in one of the answers to the question linked above by Thomas. –  goldilocks Jan 13 at 12:31
add comment

2 Answers 2

You could remove your password on the server and in /etc/ssh/sshd_config set:

PermitEmptyPasswords yes

but I think that is dangerous.

You should just generate a public/private key-pair with ssh-keygen and copy the public key over to the server with ssh-copy-id.

share|improve this answer
    
I don't want to follow your first option (empty password). Could you explain your second option? What I would want would be ssh to "remember" the password instead of asking it each time. –  S4M Jan 13 at 11:32
    
@S4M copying your public key over to the server does exactly that. So run ssh-keygen and don't add a password. This generates files on the client under ~/.ssh. You copy the public key to the server with ssh-copy-id yourname@yourserver.domain and after giving your password fot that, you don't have to give it anymore as your private key is taken. –  Timo Jan 13 at 11:55
add comment

I would recommend using public key authentication over storing a password.

With SSH public key authentication, you generate a public & private key on the client system and then send the public key to the remote host. Then the remote system will allow anyone to log in who has the private version of that key.

Setup:

  1. On the client run ssh-keygen. Just press enter several times and accept the defaults (empty password when asked).
  2. Run ssh-copy-id username@remote.hostname.com
  3. You can now ssh to the remote host just by doing ssh username@remote.hostname.com.

Now this is somewhat insecure as anyone on your local system who obtains your private key (stored at ~/.ssh/id_rsa) can ssh to that remote host (though the key is protected, so you'd have to be root to be able to get to it). The solution there is to add a password to the private key, and then use a keyring to store the password so you don't have to type it in every time, but that's beyond the scope of this answer. There are lots of other questions/answers here that provide an explanation on how to accomplish this.

share|improve this answer
add comment

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