How to setup a Password Free Linux Remote Log In

This is helpful when you remote log in to a Linux machine frequently. It stores your account password safely on the remote machine so that only your local account on your current machine can log in to the remote machine without needing to enter a password.

Warning: Before setting this up, make sure you understand the concept of SSH and working remotely on another Linux computer!

YOU are responsible for the security of your account on the remote machine!

Here are the steps:

  1. On your local Linux computer (for example aircraft.atmos.und.edu), open a terminal, and type: ssh-keygen -t ed25519 -C “delene@aero.und.edu” to generated two key in ~/.ssh. Where you need to replace “delene@aero.und.edu” with your email address.
  2. You will get a prompt asking you where to save the key. The default is given within (). Press enter key to use the default.
  3. You will get another prompt to enter a pass phrase, leave it blank by hitting “Enter”
  4. The passkey is generated, you should have two files in /home/username/.ssh/
  5. Use a text editor (e.g. vi) to open the public key file, *pub*
  6. opy the entire string, starting with “ssh- …”
  7. Now log in to your remote Linux machine. To navigate to your “~/.ssh/” directory, type: .ssh
  8. You should see a file named “authorized_keys”, change the file's permission by entering: chmod 600 authorized_keys. If you don't have a file named “authorized_keys”, type: gvim authorized_keys. This will create the file for you. This assumes that when you ssh-ed into the remote location, you typed “ssh -Y remoteLocation”. The -Y allows you to use graphical interfaces.
  9. Make sure your .ssh directory has the correct permissions. Type: chmod 700 ~/.ssh
  10. Now only you have the permission to read/write to this file (for security purpose), use a text editor to open this file and paste the string you copy from your “id_rsa.pub”
  11. Save and exit the file “authorized_keys”

At this point, the setup is complete!

You should be able to SSH in the remote Linux machine without getting a prompt to enter your password.

How to Handle Multiple Usernames between Local and Remote Machines

If your local machine has a different username than the remote machine, an ssh configuration file can be setup so a username will not have to be entered to connect to the remote machine.

touch config && chmod 600 config
host aircraft
hostname aircraft.atmos.und.edu
user username_on_aircraft
user default_username