Log in with an SSH private key on Linux and macOS (2024)

This article demonstrates how to use a private key to log in to a Linux®
server by using a private key with a Terminal session on macOS®. However,
you can follow the same process to use a private key when using any
terminal software on Linux.

Note: For information about using Secure Shell (SSH) private keys on Microsoft®
Windows® operating systems, see
Logging in with an SSH Private Key on Windows
and Generate RSA keys with SSH by using PuTTYgen.

Prerequisites

To complete this process, you need the following software applications:

  • SSH client software that is installed on your Linux or macOS operating system by default.
  • Your favorite text editor. This example uses the vim text editor.
  • Your private key. For more information about generating a key on Linux or macOS, see
    Connect to a server by using SSH on Linux or Mac OS X.

Log in with a private key

  1. Using a text editor, create a file in which to store your private key. This example uses
    the file deployment_key.txt.

  2. To edit the file in vim, type the following command:

     vim deployment_key.txt
  3. After the editor starts, press i to turn on insert mode.

  4. Paste your private key, such as the one in the following image, into the file.
    Be sure to include the BEGIN and END lines.

     <img src="https://assets.docs.rackspace.com/support/how-to/cloud-servers/logging-in-with-an-ssh-private-key-on-linuxmac/Linux2.png" alt="" title="">
  5. To save your changes, press Esc.

  6. Type :wq to write the file and return to the command line.

  7. Run the following command to change the file permissions to 600 to secure the key. You can also set them to 400.
    This step is required:

     chmod 600 deployment_key.txt
  8. Use the key to log in to the SSH client as shown in the following example, which loads the key in file deployment_key.txt, and logs in as user demo to IP 192.237.248.66:

     ssh -i deployment_key.txt [emailprotected]
  9. When you are prompted to confirm the connection, type yes and then press Enter.

  10. If your SSH key requires a password, enter it when prompted to complete the connection.

Updated 9 months ago

Log in with an SSH private key on Linux and macOS (2024)
Top Articles
Stripe vs. Paypal: Which is Better in 2024?
Factors of Production | Introduction to Business
Katie Pavlich Bikini Photos
Gamevault Agent
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Free Atm For Emerald Card Near Me
Craigslist Mexico Cancun
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Doby's Funeral Home Obituaries
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Select Truck Greensboro
Things To Do In Atlanta Tomorrow Night
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Craigslist In Flagstaff
Shasta County Most Wanted 2022
Energy Healing Conference Utah
Testberichte zu E-Bikes & Fahrrädern von PROPHETE.
Aaa Saugus Ma Appointment
Geometry Review Quiz 5 Answer Key
Walgreens Alma School And Dynamite
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Dmv In Anoka
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Pixel Combat Unblocked
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Rogold Extension
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Weekly Math Review Q4 3
Facebook Marketplace Marrero La
Nobodyhome.tv Reddit
Topos De Bolos Engraçados
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hampton In And Suites Near Me
Stoughton Commuter Rail Schedule
Bedbathandbeyond Flemington Nj
Free Carnival-themed Google Slides & PowerPoint templates
Otter Bustr
Selly Medaline
Latest Posts
Article information

Author: Barbera Armstrong

Last Updated:

Views: 5846

Rating: 4.9 / 5 (79 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Barbera Armstrong

Birthday: 1992-09-12

Address: Suite 993 99852 Daugherty Causeway, Ritchiehaven, VT 49630

Phone: +5026838435397

Job: National Engineer

Hobby: Listening to music, Board games, Photography, Ice skating, LARPing, Kite flying, Rugby

Introduction: My name is Barbera Armstrong, I am a lovely, delightful, cooperative, funny, enchanting, vivacious, tender person who loves writing and wants to share my knowledge and understanding with you.