I would like to know how to allow multiple users to access my VPS using SSH.
I tried to edit ~/.ssh/config
because i expected it to manage users access from the same remote IP.
As I see, when you register for a VPS Droplet, you generate a public key and assign it to an user. That's donne and I have already logged in with them to the root user. It generated a config file for that user on my local machine.
However, I added a second user ron
on the Droplet and created an authorized_keys
file for that user to allow me log in with that user on SSH. This requires me to create a config file on my machine in order to log in as both users (ron and root). Here is the file I created (The IP address given is just an example):
Host 161.00.100.100
HostName 161.00.100.100
User ron
IdentityFile ~/.ssh/private_key_for_ron
IdentitiesOnly yes
Host 161.00.100.100
HostName 161.00.100.100
User root
IdentityFile ~/.ssh/private_key_for_root
IdentitiesOnly yes
After creating this, I can only SSH in to the remote server as user ron
and not root
. In case it's helpful, the remote server on DO is Ubuntu and my local machine is Debian.
What am I doing wrong?
You may just need to name the Host
to be two different names
Host do-ron
HostName 161.00.100.100
User ron
IdentityFile ~/.ssh/private_key_for_ron
IdentitiesOnly yes
Host do-root
HostName 161.00.100.100
User root
IdentityFile ~/.ssh/private_key_for_root
IdentitiesOnly yes
ssh do-ron
ssh do-root