Generating A New SSH Key Pair
Check for Pre-existing Keys
Before generating an SSH key in your shell, check if you already have one on your local system by running the following command.
Windows Command Line:
If you see a long string beginning with "ssh-rsa" and wish to use the existing key, you can skip straight to "Deploy Your Key". If you get an error saying the file or directory is not found, you need to generate a key pair.
Generating New Keys
Get Your Tools Together
If you are reading this tutorial, it's likely that you don't have SSH key tools on your local system. For Windows users, the simplest method is to download and install Git for Windows. It comes with ssh-keygen as part of the bundle and ready to use from the commandline or PowerShell.
Linux and MacOS users should find the required SSH tools already installed.
Making Your Keys
Assuming you now have ssh-keygen installed, open a command line and run the following:
ssh-keygen -t rsa -C "firstname.lastname@example.org"
You will be prompted for a location to save the keys. The default path and filename should work in most cases. You can just press <ENTER> to accept the shown default. You will also be prompted for a password. We recommend that you password protect your key. If you wish to trade some level of security for convenience, foregoing the password, you now understand the risks.
Once again we stress the importance of keeping your private key confidential, especially if you chose not to password protect it.
You can use the same command from earlier where we checked for pre-existing keys to view your new public key. You can modify the command slightly to simultaneously copy the key to the clipboard
Windows Command Line:
type %userprofile%\.ssh\id_rsa.pub | clip
cat ~/.ssh/id_rsa.pub | clip
pbcopy < ~/.ssh/id_rsa.pub
Linux (Requires xclip)
xclip -sel clip < ~/.ssh/id_rsa.pub
Deploy Your Key
You will want to leave both public and private keys in your .ssh directory. Now that you have a copy of your public key on your clipboard (from the previous step), you can paste it into the Razyr portal in the "Preferred Mode" panel. Hit the "Submit Public Key" button and you're ready to go.
If you would like to confirm correct installation of your key, run the command
ssh-keygen -lf ~/.ssh/id_rsa.pub locally and compare the fingerprint and keytag to the values displayed in the portal.
Connect Via Your Apps
Modern terminals, file transfer programs, web authoring systems and programming IDEs will all support the option to use SSH keys in lieu of passwords. Typically it's a check box with a pop-up window to select your key on the same screen you would set an SSH password. Select id_rsa.pub from your .ssh directory.
I added my public key to the portal, but it's not working..
There could be a number of reasons. If we have your key and you're using the correct hostname and TCP port, then the problem is most likely unique to the setup of your local application. RTFM.
- Check the spelling of the host name. The shared web hosting server is HFX1.RAZYR.NET.
- Check the port number. All new Razyr servers listen for SSH on port 22.
- Check that the fingerprint and keytag of your public key matches the information displayed on the Razyr Portal.
ssh-keygen -lf ~/.ssh/id_rsa.pubIf not, copy your entire public key into your clipboard and add it to the portal again. Confirm that the portal has your key.