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 carefully followed the tutorial there:

http://www.cyberciti.biz/faq/ssh-password-less-login-with-dsa-publickey-authentication/

And then i wrote the following script.sh on my local machine

echo "Sync"

rsync -avz --links /home/jansiatest/.jenkins/workspace/svn_to_demo/trunk/CPS/ jansia@ps27670.dreamhost.com:/home/tasklite/test

But when i launch the script typing ./script.sh it keeps asking me for the password on the server again.

I don't know what am I missing exactly

share|improve this question
1  
missing -e ssh flag? Try running your command directly (ie type rsync -avz ...). –  Eric DANNIELOU Aug 30 '12 at 16:23
    
@EricDANNIELOU, the -e ssh has been the default behavior for many years now, it is almost never required. –  Zoredache Aug 30 '12 at 16:28
    
My question is, can you login using SSH and not get prompted for a password without using rsync? When you were generating your keypair, you left the pass-phrase empty right? –  Zoredache Aug 30 '12 at 16:29
    
no i'm always prompted, so a problem in my RSA config i guess –  Jerome Ansia Aug 30 '12 at 16:29
1  
@JeromeAnsia If your public key is correctly deployed in /home/jansia/.ssh/authorized_keys, the next thing to do is look at the log files on the server to see what sshd thinks is going on. It's possible that permissions are not correct on the directory, or for /home/jansia, etc. You need to check your logs. –  cjc Aug 30 '12 at 16:51
show 2 more comments

3 Answers

up vote 2 down vote accepted

Check the permissions on the .ssh directory on the remote host accepting the key. Key auth will not work if the permissions are readable by any other user. The .ssh directory should be 700 and authorized keys should be 600. Or, drwx------ and -rw-------, respectively. I forget this every time I set up a new host.

share|improve this answer
add comment

It should work you have not correctly deploy your ssh key.

On Debian/Ubuntu, you can deploy it with this command :

ssh-copy-id jansia@ps27670.dreamhost.com
share|improve this answer
    
Thanks i typed this command on my local machine, it asked for my password, but still not working :/ –  Jerome Ansia Aug 30 '12 at 16:44
add comment

Use the rsync -e option to specify a script you write that runs ssh with options you control. Use the ssh option -o "batchmode yes" to block password prompts. Now if the keys do not get access, there will be an error message and ssh will exit with a status code. Be sure your script passes that status code back to rsync. If your script outputs anything, be sure it outputs only to STDERR. If it still fails, next diagnose why the key(s) is/are not accepted by the server.

share|improve this answer
    
Thanks Skaperen but i just found the answer :p –  Jerome Ansia Aug 30 '12 at 19:41
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.