-1

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.

randeepsp
  • 101
  • 2

2 Answers2

1

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

Terence Johnson
  • 463
  • 4
  • 12
1

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.

ewwhite
  • 194,921
  • 91
  • 434
  • 799