Linux Guide
Useful commands and tips for the Linux ecosystem.
12. Oct 2023SSH key-based authentication
How to
Create a new SSH key without a passphrase.
ssh-keygen -t rsa -b 4096
Copy the SSH key to the remote device you want to log in.
ssh-copy-id -i <ID_RSA> <USER@HOST>
Add the following snippet to your SSH config file which is located at ~/.ssh/config
. This links the host address with a specific private key.
Host <IP_ADDRESS>
User <USER>
IdentityFile ~/.ssh/<PRIVATE_KEY>
IdentitiesOnly yes
SSH Agent
To start the SSH agent manually run the following to commands.
eval $(ssh-agent)
ssh-add ~/.ssh/<PRIVATE_KEY>
To stop the SSH agent lookup the PID and kill the process.
ps aux | grep ssh-agent
kill <SSH_AGENT_PID>