how to connect from mac to centos using ssh private/public keys (video)

No Comments


  • Access to your centos machine
  • Mac OS X v. 10.9.x
  • Basic command line knowledge
  • A virtual or physical machine running centos connected to your network or with internet access


Video / Text:

Using encrypted keys for authentication offers two main benefits. Firstly, it is convenient as you no longer need to enter a password (unless you encrypt your keys with password protection) if you use public/private keys. Secondly, once public/private key pair authentication has been set up on the server, you can disable password authentication completely meaning that without an authorized key you can’t gain access – so no more password cracking attempts. 

It’s a relatively simple process to create a public/private key pair and install them for use on your ssh server. 

First, create a folder called .ssh in your home directory and cd into it (make sure you also have it on the server in the home directory of the user you are connecting with):

$ mkdir ~/.ssh; cd ~/.ssh

Second, create a public/private key pair on the client that you will use to connect to the server (you will need to do this from each client machine from which you connect):

$ ssh-keygen -t rsa -C "Name Surname" -f name

Replace “Name Surname” and “name” with your name. This is to give it a bit of personalisation. For my example here I will use it like this:

$ ssh-keygen -t rsa -C "TheiNoob Tutorials" -f theinoob