Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
81 lines (46 sloc) 3.06 KB

Mac Users - Generating and Using SSH Keys with Terminal

These instructions are intended for Mac users that want to generate an SSH key and start using it to connect to the Linux VPS. This step is to be completed on the computer that you will be using to manage the Linux VPS.

Generating an SSH Key

  1. Open the application named Terminal
  • Launch terminal by using Spotlight search in OS X, searching for terminal
  1. Generate an ssh key on the Mac by running the ssh-keygen command in Terminal:

    ssh-keygen
    
  • Hit ENTER to confirm the default file name.
  • Hit ENTER two times, without typing anything in, when prompted for an SSH Key Passphrase.
  1. Login to your Linux VPS via SSH by running the following command in Terminal:

    ssh root@<public_mn_ip_address_here>
    
  • Replace the variable <public_mn_ip_address_here> with your Linux VPS IP address
  • Type yes to confirm that you want to connect using SSH
  1. Generate an SSH key on the Linux VPS with the following command:

    ssh-keygen
    
  • Hit ENTER to confirm the default file name
  • When prompted for an SSH Key Passphrase, do not type anything in and hit ENTER two times to skip this step.

Using the SSH Key to Connect to the Linux VPS

  1. Open a new Terminal window on your Mac:

    ssh root@<public_mn_ip_address_here>
    
  • Replace the variable <public_mn_ip_address_here> with your Linux VPS IP address
  • Type yes to confirm that you want to connect using SSH
  1. Copy the SSH key from your Mac to your Linux VPS by running the following command on your Mac Terminal window:

    scp ~/.ssh/id_rsa.pub root@<public_mn_ip_address_here>:/root/.ssh/authorized_keys
    
  • Replace the variable <public_mn_ip_address_here> with your Linux VPS IP address
  • Type in the root password when prompted and hit ENTER

Now it's time to test that your new SSH key is indeed working!

  1. Login to the Linux VPS using the new SSH key:

    ssh root@<public_mn_ip_address_here>
    
  • Replace the variable <public_mn_ip_address_here> with your Linux VPS IP address
  • You should no longer be prompted to enter a password.
  • If you were prompted for a password then one of the previous steps failed and you will need to try again.

If you are able to login to the Linux VPS without being prompted for a password then this process is complete and you can proceed to next section to :ref:`disable password logins and root login access<disablepasswordlogins>`.