====== 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: - 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. - You will get a prompt asking you where to save the key. The default is given within (). Press enter key to use the default. - You will get another prompt to enter a pass phrase, leave it blank by hitting "Enter" - The passkey is generated, you should have two files in /home/username/.ssh/ - Use a text editor (e.g. vi) to open the public key file, *pub* - opy the entire string, starting with "ssh- ..." - Now log in to your remote Linux machine. To navigate to your "~/.ssh/" directory, type: .ssh - 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. - Make sure your .ssh directory has the correct permissions. Type: chmod 700 ~/.ssh - 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" - 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. * Navigate to the ~/.ssh directory * Create a config file and set user-only read/write permissions by typing: touch config && chmod 600 config * Within the config file, type something like below (explanation of each line follows): host aircraft hostname aircraft.atmos.und.edu user username_on_aircraft user default_username * The first line ("host") is the nickname of the remote computer to be connected to. To access aircraft.atmos.und.edu as written above without needing a preceding username, all that needs to be typed is 'ssh aircraft'. * The second line ("hostname") is the full hostname of the remote computer. * The third line ("user") is the username used to login to the remote computer * The fourth line ("user") is the default username to use for all other ssh connections. * More connection configurations can be added between the third and fourth lines by repeating lines 1-3.