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
[sourcecode language="plain" title="Open sshd_config for editing"]nano /etc/ssh/sshd_config[/sourcecode]
[sourcecode language="plain" title="uncomment (remove the #) these lines in /etc/ssh/ssdh_config and write the changes"]
#RSAAuthentication yes
#PubkeyAuthentication yes
[/sourcecode]
[sourcecode language="plain" title="restart the sshd service"]service sshd restart[/sourcecode]
[sourcecode language="plain" title="put your private key in your other environment and test it"]ssh yourserver.tld -i ~/.ssh/id_rsa[/sourcecode]

Similar Posts