To add your public key to the authorized_keys file on the target system, follow these steps:
-
Create the
.sshdirectory (if it doesn't already exist):mkdir -p ~/.ssh -
Append your public key to the
authorized_keysfile:cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keysThis command assumes your public key is located at
~/.ssh/id_rsa.pub. Adjust the path if your key is stored elsewhere. -
Verify the contents of the
authorized_keysfile:cat ~/.ssh/authorized_keysYou should see your public key listed.
-
Set the correct permissions for the
authorized_keysfile:chmod 600 ~/.ssh/authorized_keysThis command ensures that only the owner can read and write to the file, which is a security requirement.
After completing these steps, you should be able to SSH into the target system without needing to enter a password.
