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.

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

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


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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