How to add your SSH keys to a node for passwordless auth

If you're looking to add your ssh keys to do passwordless authentication, use this command:

cat ~/.ssh/id_rsa.pub | ssh remote_username@server_ip_address "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"

There is also an option to use:
ssh-copy-id -i ~/.ssh/id_rsa.pub remote_username@server_ip_address

If there is a diffrent public key that you want to specify, just make sure that you use the right path! Hope this helps!

Previous
Previous

How to set up your own Kubernetes Cluster?

Next
Next

How To Use Systemctl to Manage Systemd Services and Units