Why?¶
Jun 22, 2012 SSH keys provide a more secure way of logging into a virtual private server with SSH than using a password alone. Diablo 3 steam key generator. With SSH keys, users can log into a server without a password. This tutorial explains how to generate, use, and upload an SSH Key Pair.
SSH keys have numerous advantages over passwords
- Increased security: they are nearly impossible to brute force or guess
- Ease of management: Need access to a friend’s computer? Just send them yourpublic key. No more creating and changing random passwords.
- Type less passwords: You can use ssh-agent to cache your key, so you can usessh without typing your password every time
- Automated scripts: Because you don’t need to type your password every time,its easier to automate tasks that require ssh
How?¶
Linux/OS X (Short Version)¶
- Run this command:
- Accept the default location, and enter a secure passphrase that you (and onlyyou) will remember.
- Email us the contents of ~/.ssh/id_rsa.pub
Linux/OS X (Detailed)¶
- Use the
ssh-keygen
utility to create your key. For a 2048 bit RSA key do:
For increased security you can make an even larger key with the -b option. Forexample, for 4096 bits do:
The OSL recommends using RSA over DSA because DSA keys are required to be only1024 bits.
- When prompted, you can press Enter to use the default location(
/home/your_username/.ssh/id_rsa
on Linux, or/Users/your_username/.ssh/id_rsa
on Mac) if you don’t already have a keyinstalled, or specify a custom location if you are creating a second key (orjust want to for whatever reason). - Enter a passphrase at the prompt. All people connecting to OSL servers mustuse a passphrase. This is just a password used to unlock your key. Ifsomeone else gets a copy of your private key they will be able to log in asyou on any account that uses that key, unless you specify a passphrase. If youspecify a passphrase they would need to know both your private key andyour passphrase to log in as you.
- After you re-enter your passphrase, ssh-keygen may print a little picturerepresenting your key ((you don’t need to worry about this now, but it ismeant as an easily recognizeable fingerprint of your key, so you could know ifit is changed without your knowledge - but it doesn’t seem to be widely used))then exit.
- Your private key should now be in the location you specified, and your publickey will be at that same location but with ‘.pub’ tacked onto the filename.
Note
If you are creating this key for use with an OSL SSH account, copy and pastethe public key into your ticket. If we didn’t ask you for a public key but youwant one added to your account email it to support@osuosl.org, being sure tospecify who you are and what project(s) you are associated with.
- Or, to use the public key on a computer under your control, add it to
~/.ssh/authorized_keys
(you can specify multiple public keys, one perline). - Never share your private key file, only the public key file.
Windows (using putty)¶
Linux Generate Ssh Key 4096 File
Great guide on setting up Filezilla with ssh keysDownload and start theputtygen.exe generator.
- In the “Key” section choose SSH-2 RSA and press Generate.
- Move your mouse randomly in the small screen in order to generate the keypairs.
- Enter a key comment, which will identify the key (useful when you use severalSSH keys).
- Type in the passphrase and confirm it. The passphrase is used to protect yourkey. You will be asked for it when you connect via SSH.
- Click “Save private key” to save your private key.
- Click “Save public key” to save your public key.
Note
If you are creating this key for use with an OSL SSH account, copy and pastethe public key into your ticket. If we didn’t ask you for a public key but youwant one added to your account email it to support@osuosl.org, being sure tospecify who you are and what project(s) you are associated with.
- keep your private key in a safe place
- when using putty go to connection->SSH->Auth and Browse to your private key
An SSH Key allows you to log into your server without needing a password. SSH Keys can be automatically added to servers during the installation process.
Creating an SSH key on Windows
The simplest way to create SSH key on Windows is to use PuTTYgen.
- Download and run PuTTYgen.
- Click the 'Generate' button.
- For additional security, you can enter a key passphrase. This will be required to use the SSH key, and will prevent someone with access to your key file from using the key.
- Once the key has been generated, click 'Save Private Key'. Make sure you save this somewhere safe, as it is not possible to recover this file if it gets lost
- Select all of the text in the 'Public key for pasting into OpenSSH
authorized_keys
file'. This is what you would need to enter into the control panel to use the SSH key.
Creating an SSH key on Linux
The tools to create and use SSH are standard, and should be present on most Linux distributions. With the following commands, you can generate ssh key.
- Run:
ssh-keygen -t rsa
. For a more secure 4096-bit key, run:ssh-keygen -t rsa -b 4096
- Press enter when asked where you want to save the key (this will use the default location).
- Enter a passphrase for your key.
- Run
cat ~/.ssh/id_rsa.pub
- this will give you the key in the proper format to paste into the control panel. - Make sure you backup the
~/.ssh/id_rsa
file. This cannot be recovered if it is lost.
Adding an SSH key to your control panel
- Once you're logged in, go to https://my.vultr.com/sshkeys.
- Click 'Add SSH Key'.
- Enter a descriptive name for the key.
- Paste in your SSH public key. This is a long string beginning with 'ssh-rsa'. You should have saved this from when you generated your key.
- Click 'Add SSH Key'.
- Now, when you're deploying servers you will be able to select which SSH keys you want to add to the newly deployed server. Remember to select the keys before the initial server deployment, otherwise you will need to log into the newly created server and add the SSH keys manually.
Limitations
Generate Ssh Key Aix
- SSH keys are only available for Linux and FreeBSD. They are not supported for Windows, custom ISOs, nor snapshot restores.
- SSH keys can only be managed from the control panel during deployment. You cannot use the control panel to manage them on an already-installed instance.
Connecting to a server using an SSH key from a Windows client
- Download and run the PuTTY SSH client.
- Type the IP address or Username + IP address (
[email protected]
) of the destination server under the 'Host Name' field on the 'Session' category. - Navigate to the 'Connection -> SSH -> Auth' category (left-hand side).
- Click 'Browse..' near 'Private key file for authentication'. Choose the private key file (ending in
.ppk
) that you generated earlier with PuTTYgen. - Click 'Open' to initiate the connection.
- When finished, end your session by pressing
Ctrl+d
.
Connecting to a server using an SSH key from a Linux client
- Check that your Linux operating system has an SSH client installed (
which ssh
). If a client is not installed, you will need to install one. - Initiate a connection:
ssh -i /path/to/id_rsa [email protected]
- When finished, end your session by pressing
Ctrl+d
.