Cloud House Technologies Logo
CloudHouse Technologies
HomeServicesProjectsBlogAbout UsCareersContact UsLogin
    Cloud House Technologies Logo
    CloudHouse Technologies
    HomeServicesProjectsBlogAbout UsCareersContact UsLogin

    How to generate and use SSH keys for secure authentication on Linux, macOS, and Window

    ABHILASH CA

    Junior Devops Engineer

    Last Updated: 12 July 2026
    How to generate and use SSH keys for secure authentication on Linux, macOS, and Window
    🖥️12,400+PCs Fixed
    ⭐4.9★Google Rating
    ⚡<15 minAvg. Response
    🛡️ISO 27001Certified

     

    Stop Typing Your
    Password Every Time

    A real guide to SSH keys on Linux, Mac, and Windows 

    SSH KEYS  ·  ALL PLATFORMS  ·  8 MIN READ

    I used to type my server password probably a dozen times a day. Then one afternoon I finally sat down and set up SSH keys, and I genuinely could not believe I had waited so long. It took maybe ten minutes. Now I just type ssh user@server and I'm in — no password, no friction.

    Here's the thing: the guides out there are either too simple (they just show you one command) or too long (they explain cryptography for 20 paragraphs before getting to the point). This is neither. This is the guide I wish I'd had — covering Linux, Mac, and Windows side by side, with a clear comparison at the end.

    Let's get into it.

    First — What Actually Are SSH Keys?

    When you SSH into a server, you need to prove you're you. Normally that's a password. SSH keys do the same job, but with cryptography instead.

    You get two files:

    • Private key — lives on your machine, never leaves it
    • Public key — goes on the server you want to access

    When you connect, the server checks if your private key matches the public key it has on file. Match? You're in. No password needed.

    The padlock analogy: Give the server your padlock (public key). Keep the key to open it (private key). Anyone can have the padlock — only you can open it.

    Linux

    SSH Keys on Linux

    Linux is where SSH was born, and every distro — Ubuntu, Debian, Fedora, Arch, you name it — ships with OpenSSH pre-installed. Open your terminal and you're ready to go right now.

    Step by step

    1. Generate your key pair Run this in your terminal. That's all you need to start.

      ssh-keygen

      It'll ask where to save it — just hit Enter for the default (~/.ssh/id_rsa). Then it asks for a passphrase. Optional, but smart if you're on a shared machine.

    2. Copy your public key to the server Linux has a beautiful little command for this:

      ssh-copy-id user@your-server-ip

      Enter your server password one last time. This is the last time you'll ever need it.

    3. Test it

      ssh user@your-server-ip

      You should land straight in. No password prompt. First time this happens feels weirdly satisfying.

    Your key files

    They live in ~/.ssh/:

    • id_rsa — your private key. Guard it.
    • id_rsa.pub — your public key. Safe to share with servers.

    Never copy id_rsa anywhere. If someone gets your private key, they get access to every server that trusts it.

    macOS

    SSH Keys on macOS

    Every Mac comes with SSH pre-installed. Always has. You don't need Homebrew or any extra tools. Just open Terminal — Cmd + Space, type "Terminal" — and you're already set up.

    The process is nearly identical to Linux, which is no surprise since macOS is Unix under the hood.

    Step by step

    1. Open Terminal and generate your key

      ssh-keygen

      Default location is ~/.ssh/id_rsa. Press Enter to accept. Passphrase is optional — worth adding on a laptop that travels with you.

    2. Copy your public key to the server

      ssh-copy-id user@your-server-ip

      Same command as Linux. Type your password this one last time.

    3. Test it

      ssh user@your-server-ip

      Straight in. Done.

    Mac tip: You can add your key to the macOS Keychain so you don't have to re-enter your passphrase after every reboot: ssh-add --apple-use-keychain ~/.ssh/id_rsa

    Your key files

    Same as Linux — they live in ~/.ssh/ in your home folder. Private key is id_rsa, public key is id_rsa.pub.

    Windows

    SSH Keys on Windows

    Windows used to be annoying for this — you had to install PuTTY and deal with a completely different key format. But since Windows 10, OpenSSH is built right in. Same commands, same flow, no extra software needed.

    First — check that OpenSSH is installed

    Open PowerShell (search for it in the Start menu) and run:

    ssh -V

    See a version number? You're good. If not, go to Settings → Apps → Optional Features and install "OpenSSH Client".

    Step by step

    1. Generate your key pair in PowerShell

      ssh-keygen

      Keys will be saved to C:\Users\YourName\.ssh\ by default. Hit Enter to accept. Add a passphrase or skip it — your call.

    2. Copy your public key to the server Windows doesn't have ssh-copy-id built in, so use this instead:

      type $env:USERPROFILE\.ssh\id_rsa.pub | ssh user@your-server-ip "cat >> ~/.ssh/authorized_keys"

      Yeah, it's a mouthful. Copy-paste it. You'll enter your server password one last time here.

    3. Test it

      ssh user@your-server-ip

      In without a password. It works.

    Your key files (Windows)

    Located at C:\Users\YourName\.ssh\:

    • id_rsa — private key. Don't share.
    • id_rsa.pub — public key. Goes on servers.

    WSL users: If you use Windows Subsystem for Linux, the Linux steps work perfectly inside WSL. Most developers prefer that path.

    Side-by-Side Comparison

    All three platforms — same task, different details.

    What🐧 Linux🍎 macOS🪟 Windows
    SSH pre-installed?Yes, alwaysYes, alwaysYes (Win 10/11)
    Where to run commandsTerminalTerminalPowerShell
    Generate key commandssh-keygenssh-keygenssh-keygen
    Copy key to serverssh-copy-id user@hostssh-copy-id user@hostLong type | ssh command
    Key location~/.ssh/~/.ssh/C:\Users\You\.ssh\
    Private key fileid_rsaid_rsaid_rsa
    Public key fileid_rsa.pubid_rsa.pubid_rsa.pub
    Keychain/agent supportssh-agentmacOS KeychainWindows ssh-agent
    Overall difficultyEasyEasyMedium

    The Rules — Don't Skip These

     Never share your private key

    The private key (id_rsa) is your identity. If someone gets it, they get into every server that trusts it. Treat it like a password — actually, treat it better.

     Back it up

    If you lose your private key and the server only allows key-based logins, you're locked out. Keep a secure backup somewhere you won't lose it.

     Use a passphrase on laptops

    A passphrase on your private key adds one more layer. If your laptop is stolen, the key alone isn't enough to get in.

     Only share the .pub file

    The public key (id_rsa.pub) is the only thing that goes on servers. Everything else stays on your machine.

    · · ·

    That's Actually It

    Ten minutes to set up. Years of typing passwords saved. SSH keys are one of those things where the payoff is wildly disproportionate to the effort required — you do it once and then it just quietly works in the background forever.

    Whichever platform you're on — Linux, Mac, or Windows — the core idea is the same: run ssh-keygen, copy your public key to the server, test the connection. That's the whole thing.

    Now go set it up. Future you will be grateful.

     

    Key-based AuthenticationSSH Keys

    Get the Free Linux Server Admin Cheatsheet (PDF)

    Essential commands for server management, networking, and troubleshooting — all on one printable page.

    Running Linux servers? Let us manage them for you.

    Our Managed Linux Server plans cover updates, security hardening, monitoring, and 24/7 incident response — so your servers stay up and your team stays focused.

    • Proactive OS patching and security updates
    • 24×7 monitoring with instant alerting
    • Backup configuration and disaster recovery
    • Dedicated Linux engineers on call
    See Pricing Plans →

    What our customers say

    “Our production server went down at 2 AM. CloudHouse had it back online in under 20 minutes. Incredible response time.”

    Arun S.

    CTO, SaaS Startup

    “They migrated our entire infrastructure from Ubuntu 18 to 22 with zero downtime. Couldn't have asked for better.”

    Deepak N.

    DevOps Lead

    Frequently Asked Questions

    Yes — 90% of fixes are done over a secure remote session in 15–30 minutes. Our technicians connect safely using industry-standard tools.

    Book your free 15-minute diagnosis

    A certified technician will call you back within 15 minutes during business hours.

    Share this article

    Leave a Comment

    Comments (0)

    Loading comments...

    Still stuck?

    Free remote diagnosis by a certified engineer. 15 minutes. No credit card.

    Call Now — FreeWhatsApp Us

    Why CloudHouse?

    • ISO 27001:2022 certified
    • 12,400+ devices supported
    • 4.9★ on Google
    • Sub-15-minute response

    CloudHouse Technologies

    Innovative cloud solutions for modern businesses. We deliver cutting-edge technology with exceptional service.

    Contact Us

    CloudHouse Technologies Pvt.Ltd
    Special Economic Zone(SEZ),
    Infopark Thirissur,4B-15,
    Indeevaram,Nalukettu Road,
    Koratty, Kerala, India-680308
    0480-27327360
    info@cloudhousetechnologies.com

    Quick Links

    • Our Services
    • Gold Loan Software
    • About Us
    • Contact
    • Terms and Conditions
    • Privacy Policy
    ISO27001:2022
    Certified

    © 2026 CloudHouse Technologies Pvt.Ltd. All rights reserved.

    Back to top