I've created the private/public key pair using ssh-keygen. I installed the public as described in https://help.ubuntu.com/community/SSH/OpenSSH/Keys
And it works without a password, as expected – but only when logging in to root. Logging in directly as root is obviously a bad idea.
But the question is, how is that key pair associated or restricted to a given userid? I wouldn't expect a user to be able to log into ANY account on a system simply by virtue of having the public key installed on a host…
Best Answer
The command:
As documented in the link above does not work from mac. Therefore, I logged in as root and of course, that is where the key was installed.
The answer seems to be: If You log in as the user, then
cat
the public key to the~/.ssh/authorized_keys
file.