I'm trying to create an ssh key for another user. I'm logged in as root. Can I just edit the files generated by ssh-keygen and change root to the user I want?
|
|
ssh keys should never be generated for another user. The private key is called private for a reason. If you want to create a keypair for yourself you could do that with
The other file, just called But technically you could store the key anywhere, but keep in mind the key is not allowed to be readable for anyone but the user. |
|||||||||||
|
|
There's no user information in the SSH keys. Last field in a public key is a comment (and can be changed by ssh-keygen -C newcomment). No need to do anything special to make a key for another user, just put it in the right location and set permissions. |
|||
|
|
|
Become the user by using su and run the key as that user:
|
||||