SSH: Using the public key

  • Once you've copied the public key to the remote machine you need to put it in the .ssh/authorized_keys file (creating it if necessary) for each user you want to be able to connect as.

  • You need make sure the .ssh directory exists and is only accessible to the user by using the command mkdir ~/.ssh >> chmod 0700 ~/.ssh, while logged in as the user in question.

  • then you can use the command cat ~/ >> ~/.ssh/authorized_keys (replacing ~/ with the path to the file you copied which contains public key), as the user in question.