ssh-keygen works for root only?

Does ssh-keygen -t rsa work if only set for root user

i.e, if the username on local system is sodium and i generate the key using the above said command and on the remote system if i place the key in /root/.ssh authorized_keys ,this works.

But on the remote system if the key is placed in /home/natrium/.ssh authorized_keys

This still prompts for a password.Is this the expected behavior or is that some thing wrong in the above procedure


Best Answer

Check permissions on the remote system:

$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/authorized_keys

There is a tool that could be installed in your dist (ubuntu/debian has it) called: ssh-copy-id which will do this for you:

$ ssh-copy-id <remote>

If that doesn’t work try ssh with option “-v” to see more verbose messages.

Long version:

#From client to server
client$ scp ~/.ssh/

# next, setup the public key on server
server$ mkdir ~/.ssh
server$ chmod 700 ~/.ssh
server$ cat ~/ >> ~/.ssh/authorized_keys
server$ chmod 600 ~/.ssh/authorized_keys
server$ rm ~/

You may Also Like:

Leave a Comment