SSH Keys - basic guide for macs

advertisement
Guide for Keyless Authentication
Generating keys is very simple on a Mac. It can be done with a single line on the
Terminal Application. This guide is intended for those who will like to configure
keyless authentication.
1. Launch the terminal application. This can be done by navigating to the
Utilities folders under applications or it can be done using the spotlight. For
simplicity, we will use the spotlight.
2. Once in the terminal app, copy the following command as shown below. This
command will generate the public and private keys needed for keyless
authentication.
When you run this program, you will be prompted to save your key somewhere. By
default, it is saved at your home directory under a new directory called .ssh.(For the
purpose of this guide, we will chose that location). Just press Enter and you will be
prompted to enter a passphrase. Press Enter twice and you should get a
confirmation reply in your terminal along with your RSA random art key.
Note: Make sure to not set a passphrase. This will defeat the purpose of having a
non-authentication login. If you accidently set one, redo step 2 to overwrite the
current key-gen pair.
3. The next thing to do is to copy the key to your clipboard. Again this is single
command line on the terminal and it should happen instantaneously. Notice
that we are copying the pub key from the location we wrote to in our home
directory. If you saved to another location, you will have to modify the path
to match exactly where your pub key is located.
4. Your public key is now available in your clipboard. You can verify that you
have copied it by opening up any text editor and pasting into that document
by using ⌘ + V or by right clicking and selecting paste.
5. Now that you have verified that you key is copied, next you want to login into
your SE account online. Below, you can see user abc123 loging into the
control SE domain. Type in the same command as shown below while also
replacing abc123 with your RIT username. You will be prompted to acept the
RSA key. Type in yes followed by enter and enter your SE password.
6. Next you want to create the directory .ssh in your account, if you haven’t
done so yet. If you have created your folder skip all the way to step 8.
7. Afterwards go into that directory by typing in the following.
cd .ssh/
8. We will now need to create a file called authorized_keys so we can store the
public key we copied from earlier. We will create the file by using the touch
command as shown below.
9. Next you want to use an in-text editor to edit the contents of the new file you
have already created. I used VI in this example.
10. Once in vi all you have to do is paste your key in the first line. Just hit the i
key once to enter interactive mode which will allow you to paste into the first
line. After you have pasted your public key, you will need to save. You press
the ESC key once to exit out of interactive mode, and now you type in :wq
followed by enter to execute save and exit.
11. Now all that you have to do is quit your current Terminal session and open a
new session and try to log into your account. You should no longer be
prompted to enter your password.
Download