passwordless ssh¶
We often use SSH (Secure Shell) to remotely connect to servers via the terminal. If you’re tired of entering a password every time you log in, follow the steps below to enable passwordless login.
Add server info to config file¶
Open the SSH configuration file on your PC (the SSH client).
Add the server name, IP address (hostname), and the user ID for the server to the configuration file:
generate ssh key¶
Run the following command to generate new SSH keys:
copy key to server¶
Run the following command to copy the key to server1, and enter your password when prompted:
You should now be able to log in to the server without entering a password.
Note: if you are using powershell in windows, use cat ~/.ssh/id_rsa.pub | ssh usr1@HostName "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"