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.

Since yesterday, each time I try to connect to an ssh server, I got asked for my password. What should I do to make SSH not ask for my password each time.

share|improve this question
    
Blind guess by me: check that your key is loaded with ssh-add -l. –  jw013 Jan 24 '12 at 17:41
    
I assume you are using ssh keys? If you don't use a keymanager and have a non-empty passphrase, this is normal. Either use a keymanager or create an empty passphrase for your key. I guess the former is recommended. –  Herman Torjussen Jan 24 '12 at 17:46
    
if it's "since yesterday", maybe it's just that you have updated your system, and now ssh-agent does not work anymore. –  Coren Jan 24 '12 at 17:52

2 Answers 2

up vote 4 down vote accepted

Put your public key in hostnachine:~/.ssh/authorized_keys and make sure it has the appropriate permissions -- chmod 600. See the man page, section AUTHENTICATION, for more details. Note that sshd maybe configured to disallow this method of login although I cannot fathom why.

share|improve this answer
    
Thank, that worked. However could you explain me why do I have to put it in authorized_keys and why it was working without it before. –  Ben D Jan 24 '12 at 18:06
1  
The man page has the information in the AUTHENTICATION section. As to why it was working before hand, I cannot be sure without having root access to your machines and doing some forensics work. –  Sardathrion Jan 24 '12 at 19:50
1  
You can also use ssh-copy-id in order to get your public key automatically copied to destination host, if you don't want/need to copy it manually. –  Coren Jan 25 '12 at 8:27

Check directory permissions, and file permissions.

$HOME can't be writeable by group or other.

$HOME/.ssh needs to have 700 permissions, not readable, writeable or executable by group and other.

$HOME/.ssh/authorized_keys to be not writeable or executable by anyone.

If you find that permissions aren't strict enough, try to figure out what caused the problem. Last time this happened to me, I had compiled PHP from scratch. Executing make install as root (Slackware) changed the permissions and ownership of / or /home as I recall, and kept ssh from working with authorized_keys and id_rsa.pub files that had been in place and working for ages. You want to determine what caused the problem, as changed directory ownership and/or permission can happen because of a rootkit install or something like that.

share|improve this answer

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.