To be able to ssh to a remote Linux system without entering your password, carefully follow these steps:
ls -aland see if you have a .ssh directory in your home directory.
ls -alIf the permissions on your .ssh directory are anything besides 700 (i.e., drwx------, indicating for this directory, you and only you can read, write, and execute in it), make the .ssh directory secure by entering:
chmod 700 .ssh
cd .ssh
ls -al
ssh-keygen -t rsaThe ssh-keygen program will prompt you three times:
ls -alYou should see two new files:
cat id_rsa.pub >> authorized_keysThis appends your public key to the authorized_keys file, which tells ssh to authenticate you using your key, instead of making you enter a password.
(Alternatively, you can just copy your public key and paste it into the authorized_keys file using a text editor, so long as the editor does not insert extra control characters when it pastes.)
ls -alIf the permissions on id_rsa or authorized_keys are anything besides 600 (i.e., -rw-------), enter:
chmod 600 id_rsaand/or
chmod 600 authorized_keysThis will ensure that only you can read from or write to a given file.
When you have completed these steps, the first time you ssh to a particular lab machine, you will be prompted to accept and cache its hostkey in your ~/.ssh/known_hosts file. You just have to do this once per machine; after that, ssh will see the host's name in the known_hosts file and let you ssh to it without any interaction.
Because your home directory (containing .ssh) is shared by our CS lab machines, the preceding steps should allow you to ssh from any ulab machine to any other ulab machine without being prompted for a password.
However, to keep Borg secure, accounts on it are separate from CS lab accounts. For example, your home directory is not shared on our cluster, so it will be unable to read your key from your .ssh folder.
To fix this, we just have to get your public key from your authorized_keys file in the lab into your authorized_keys file on the cluster. To do so, you will need your Borg password, which you should have received via email, so take a moment to look up that password.
The easiest way to set up password-free authentication on Borg is to use the ssh-copy-id command. To illustrate, if I were doing this, I would enter:
ssh-copy-id adams@borgBorg will then prompt you for your password; when you enter it correctly, the ssh-copy-id command will copy your public key information over to Borg and appends it to your authorized_keys file.
Try the preceding command, substituting your user-name for adams.
When you have completed these steps, test your work by trying to ssh to the cluster, for example:
ssh yourUserName@borg
(Be sure you replace yourUserName with your user name.)
Note that the first time you do so, you may have to confirm that you want to add the cluster to your lab machine's known_hosts file. But after that, you should be able to connect directly to Borg from any CS lab workstation.
If you have followed the steps correctly, you should now be able to ssh or use scp to transfer files to the cluster from a CS lab machine without entering your password -- congratulations!
Be sure you have this working before proceeding further.
If you experience difficulty getting this to work, please contact Chris Wieringa or Prof. Adams.
For security reasons, if you want to SSH directly to Borg from a non-CS-lab machine, you cannot authenticate using your password. Instead, you must use public-key authentication. To do so, you will need to replicate the setup work we have done here:
ssh -p 22122 adams@borg.calvin.eduand Borg accepts the connection.)