I’m trying to get multiple SSH keys to work for different server users, but from the same local machine.
Here’s the rundown of what I’ve done so far:
I have two user accounts on the server, one for system administration, and another one that I want to use for general website management through SFTP (does not have access to ‘sudo’ group).
I created SSH keys for both; added them to both my config file, and the
I can log in to my first, default account just fine, but connecting with the second one simply returns
permission denied (publickey)
According to the debug output during connection, it finds the second key just fine, but for whatever reason refuses to use it. Shown below is what my local ssh_config file looks like.
Is there a step I’m missing or something I’m not doing right? Any help would be sincerely appreciated.
Thanks very much!
Host kcom-siteadmin User siteadmin HostName [my website] IdentityFile ~/.ssh/personal-web/siteadmin/id_rsa Host kcom-sftp User sftpadmin HostName [my website] IdentityFile ~/.ssh/personal-web/sftpadmin/id_rsa
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Click below to sign up and get $200 of credit to try our products over 60 days!