1. Generate your keys
[sourcecode language="plain"]
ssh-keygen -t rsa -C "[email protected]"
[/sourcecode]
2. Copy public key to authorized_keys

[sourcecode language="plain"]
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[/sourcecode]
3. Chmod
[sourcecode language="plain"]
chmod 700 ~/ssh
chmod 600 ~/ssh/id_rsa.pub
chmod 600 ~/ssh/authorized_keys
[/sourcecode]
4. Enable key authentication in sshd_config
-open up sshd_config (root)
[sourcecode language="plain"]nano /etc/ssh/sshd_config[/sourcecode]
-uncomment (remove the #) these lines in /etc/ssh/ssdh_config and write the changes
[sourcecode language="plain"]
#RSAAuthentication yes
#PubkeyAuthentication yes
[/sourcecode]
-restart the sshd service
[sourcecode language="plain"]service sshd restart[/sourcecode]
-put your private key in your other environment and test it
[sourcecode language="plain"]ssh yourserver.tld -i ~/.ssh/id_rsa[/sourcecode]

Similar Posts