0

If I have a host I want to be able to connect to and I currently have a keyboard and monitor plugged in, how would I copy a key to a user so I can connect as that user remotely. Essentially I want to do the same thing as ssh-copy-id but without having to be able to connect over ssh first.

0

The keys are stored in a text file under ~/.ssh/authorized_keys

To add a new key just copy the contents of the *.pub file of your key to a new line in this file.

Some more information is available here https://www.ssh.com/ssh/authorized_keys/

  • 1
    When doing this manually, also make sure the file and directory permissions are set correctly. The authorized_keys file should be owned by either the user that is being authorized, or by root, and not be writeable by anyone else. The same applies to the ~/.ssh directory and the user's home directory. Otherwise sshd will ignore the authorized_keys file as there is a possibility that another user may have had write access to it. – telcoM Feb 23 at 8:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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