Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 '14 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 '14 at 12:31

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 '14 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 '14 at 11:55

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.


  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

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