Say I have multiple service users on a server (example.com
).
- For
foo@example.com
I use SSH with a publickey - For
bar@example.com
I use SSH with a password
I access both users regularly from my local machine.
Is there a way to configure the ~/.ssh/config
file so that it correctly detects the preferred authentication type based on the user?
In other words, is there a way to configure things per-user for a given host?
I'm imagining something like:
Host example.com
User foo
PreferredAuthentications publickey
IdentityFile ~/.ssh/key_for_foo
User bar
PreferredAuthentications password
Thanks!