Linux/Mac Tutorial: SSH Key-Based Authentication – How to SSH Without a Password

Video is ready, Click Here to View ×

In this Linux/Mac terminal tutorial, we will be learning how to configure ssh keys so that we can login to our servers without a password. Not only is this more convenient, but it is also more secure. This also allows us to write automated scripts to talk to our servers without the need of putting in passwords constantly. Let’s get started.

How to Create a Network of Machines in VirtualBox with SSH Access:

If you enjoy these videos and would like to support my…


  1. I would like to add that it is quite handy to make a file named 'config' in the local .ssh folder and put:

    Host [your shortcode]
    HostName [hostname]
    IdentityFile ~/.ssh/[key file name]
    User [username]

    [copy the above for other servers]

    You can then type in de terminal 'ssh [your shortcode]' and log in directly.

  2. I'm learning a bout SSH in last few days. If you have time well be nice to make video a bout expanding security of connection. Like AllowUser. Meaning if you can explain more of sshd_config file…

  3. Awesome explanation (you are gifted). Looking at things from multiple server's perspective, I have yet to dwell deep into maintenance aspect of keys. How is one server's private key on your machine, separate from another server's private key? Do all of them show up with the same name but different hash content inside the file? I also wonder how could one know which key belongs to which server (if you have to do it again in the future). Is this something one has to maintain (by labeling, separating into different folders etc)? Also, what is the best practice if as a server admin, you have to do it for end-users who may not be CLI/Linux proficient?

  4. one thing i really don't understand from day one that I got into cli world. old school unix guys always say that cat file then redirect to another file is more secure than cp. is that really true and necessary in very large scale like a 40g file?? i truly doubt that

  5. Nice one Corey. Can you make tutorial on pipeline @corey? As its something which very few knows and very few videos on it explaining it, we will love your quality videos on it.

  6. As someone without a root access , I was not able to set this up in my systems. Could this be because of some configuration in the sshd_config file that's preventing key based authentication?

Leave a Reply

Your email address will not be published.