Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I put the SSH key inside authorized_keys for root, can I SSH in to the server as a different user without having the authorized_keys for that user?

share|improve this question

2 Answers 2

No, you can't. Each user (including root) has their own ~/.ssh folder where the authorized keys are kept. Adding them to /root/.ssh/authorized_keys will make them available to the root user only. If you want to authorize more users, you will have to use their own authorized_keys file.

share|improve this answer

Each user has their own .ssh folder with auth keys. However, you can achieve (what I think you are trying to do) by going to the first server and typing the command.

ssh-copy-id root@server-you-need-to-connect-to.com enter your password once.

your key is copied to that user now.

repeat for other users that you need to connect as. e.g.$ ssh-copy-id user@server.com

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.