Skip to content

Adding a public SSH key for root access

  1. Copy and paste the contents of the public key file for the SSH key you are granting access to, for example yourkeyname.pub It will look something like this:-
Terminal window
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7sBaZnNypvT4tfPiEWEN2rrHKTV9pweD1BiFtOx1...I5f6GmQboRn1wpW61CjAYwNMTd yourname@yourcomputer
  1. Paste in to a new single line in /root/.ssh/authorized_keys on the server
  2. Save the file, and the SSH key you added will now have access to the server as root

To remove access to the key, remove the line relating to that key from the authorized_keys file and save.