This article explains how to import an SSH key via root access.
Importing an SSH key via root access allows secure, password-less authentication when connecting to the server, improving both security and convenience.
Steps to Import an SSH Key:
- Launch the PuTTY application on your computer.
- Under the Session menu, enter the server’s IP address.
- Ensure the SSH option is selected and click Open.
- Log in using the root password.
- Run the following command to edit the authorised keys file:
nano .ssh/authorized_keys
- Add your public SSH key (starting with ssh-rsa) on a single line.
- Press Ctrl + X, then Y to save the changes.
- Restart the SSH service using the modern command:
systemctl restart sshd
Note: Updated the SSH restart command to use systemctl for newer Linux systems.
The SSH key is now successfully imported using root access. If you experience any issues, feel free to contact our support team, available 24×7.