Adding a public SSH key for root access
- 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:-
- Paste in to a new single line in /root/.ssh/authorized_keys on the server
- 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.