Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
    • Security
Google Cloud Platform icon
Labs

Configuring Key-Based Authentication

A strong password is typically composed of upper-case and lower-case letters, numbers, and special characters. You can even create a 20-character password and, in all likelihood, nobody will ever guess it. But do you really want to type in a 20-character password every time you need to access the server? Maybe you might, but most people really do not want to. Therefore, in this lab, we will configure SSH key-based authentication, which is far more secure and you do not have to type in any passwords when you log in to the server. Furthermore, when key-based authentication is configured, most people forget to disable password-based authentication altogether. We will not forget to do this. Finally, we will also disable root-based login as an extra security precaution.

Google Cloud Platform icon
Lab platform
Lab Info
Level
Intermediate
Last updated
Sep 22, 2025
Duration
45m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Generate a Key Pair on the Client for SSH

    Note: For this lab, the use of a standalone terminal app with ssh support is best as the Instant Terminal does not permit port 61613. The instance does take a minute or so to be ready to be connected to via ssh. Please use port 61613 when connecting to this lab.

    ssh-keygen
    
  2. Challenge

    Copy the Newly Created Key Over to the Server
    1. Open your newly created key (replace <PATH_TO_PUBLIC_KEY> with your path):

      vim <PATH_TO_PUBLIC_KEY>
      
    2. Select all and copy.

    3. Open /home/cloud_user/.ssh/authorized_keys:

      vim /home/cloud_user/.ssh/authorized_keys
      
    4. Paste in the public key.

    5. Save and quit:

      ESC
      :wq
      ENTER
      
  3. Challenge

    Configure SSH to Not Allow Root Login or Password-Based Authentication and to Allow Key-Based Authentication
    1. Open the file:

      sudo vim /etc/ssh/sshd_config
      
    2. Make the following changes:

      PermitRootLogin no
      PasswordAuthentication no
      ChallengeResponseAuthentication no
      PubkeyAuthentication yes
      
    3. Save and quit:

      ESC
      :wq
      ENTER
      
    4. Restart the sshd service:

      sudo systemctl restart sshd
      
  4. Challenge

    Test the New Configuration by Logging Out and Back in with the Newly Created Key
    1. Log out:

      exit
      
    2. Log in with the newly created key (replace <PATH_TO_PRIVATE_KEY> with your path):

      ssh cloud_user@SERVER_IP -p 61613 -i <PATH_TO_PRIVATE_KEY>
      
About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight