How to use single public key for multiple hosts do i need to duplicate the entries in authorized_keys? or is there a way to do it as single configuration?
For example: Key user@host1 user@host2 user@host3
In /home/user/.ssh/authorized_keys
on the server to be accessed remotely, enter the public key (in Ubuntu, contents of /home/user/.ssh/id_rsa.pub
) for the device the user will be logging in from. This will need to be repeated for all additional servers that it is desired for the user to log in to.
If the user has more than one device used to access the server, then there should be a public key for each device, with each public key on its own line in /home/user/.ssh/authorized_keys
.
authorized_keys
and share the private key with all your clients.