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

I created a non-root user, new_user, on a Red Hat Linux machine. I then logged in as new_user and created a private/public key pair.

I've created /home/new_user/.ssh, and I've appended the public key to the authorized_keys file, but I'm not able to log in using the key pair. For instance, if I execute the command

ssh -i /home/new_user/privatekey new_user@localhost

I get prompted for a password.

share|improve this question

migrated from stackoverflow.com Sep 22 '12 at 14:17

This question came from our site for professional and enthusiast programmers.

    
Can you provide debugging output? That is, can you paste the output of ssh -v -i /home/new_user/privatekey new_user@localhost? –  Benjamin Barenblat Sep 23 '12 at 17:24

2 Answers 2

Use the ssh-copy-id command to automate the task of setting up key pairs.

share|improve this answer

This is the formula for the right permissions on the server side.

chmod go-w ~/
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

You can also use the ssh-copy-id script (available on EL5 and EL6) to copy a key from your system to the remote system. It corrects the permissions to enable remote connections to work.

share|improve this answer

Your Answer

 
discard

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