Allow Key Access for user in SSH
Allow shared key access only for one user in SSH.
Disable the password authentication for one user in your SSH config. Edit /etc/ssh/sshd_config.
<pre lang="bash">
Match User username
PasswordAuthentication no
Restart the SSH service.
<pre lang="bash">
service ssh restart
Copy user’s public key to the destination server’s authorized file in ~/.ssh/authorized_keys.
<pre lang="bash">
ssh-rsa AAAAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
<p>Back on your client, login via SSH. User will not be prompted for password since public key is already authorized on server.</p>
<pre lang="bash">
ssh username@server