The server presents its host key; the client checks known_hosts, or trusts it on first use
The two negotiate a shared session key and the channel comes up encrypted
Over the encrypted channel the client proves it holds the private key matching a public key the server has
The server accepts; an interactive shell opens on the remote machine, I/O tunneled over the encrypted connection
Beyond a shell: one-off remote commands, and scp/sftp file copy over the same connection
Check your own machine
These commands only read information — they change nothing. Run the
block for your OS, then use the table to read your own numbers
against the ideas above.
What you should see Windows 10 build 1809 and later ship the OpenSSH client, so ssh -V and ssh -G behave as on Unix. ssh -V prints the version; ssh -G prints the effective configuration for the host without connecting.
Note ssh -V writes its version to stderr. ssh -G evaluates the config for the host and exits without connecting to it, so it shows what SSH would do while doing nothing to any machine.
What you should see A listing of the key files in your .ssh folder: private keys, matching .pub public keys, known_hosts, and any config.
Note If you have never used SSH, the .ssh folder may not exist yet; that just means no keys yet. Creating keys with ssh-keygen is the separate, state-changing step left out here. On any OS, SSH refuses to use a private key that other users can read.
What you should see Identical to Linux - macOS ships the same OpenSSH client. ssh -V prints the version; ssh -G prints the resolved configuration for the host (user, hostname, port 22, identity files).
Note ssh -V writes its version to stderr. ssh -G evaluates the config for the host and exits without connecting to it - it reports what SSH would do without touching any machine.
What you should see The key files in your .ssh directory and their modes: private keys readable only by you, .pub public keys world-readable, plus known_hosts and any config.
Note If you have never used SSH, ~/.ssh may not exist yet; an empty or missing directory just means no keys yet. Creating keys with ssh-keygen is the separate, state-changing step left out here. SSH refuses to use a private key that other users can read - the permissions concept enforced in practice.
What you should see ssh -V prints the OpenSSH client version. ssh -G prints the effective configuration it would use for that host: the user, the hostname, port 22, and which identity (key) files it would try.
Note ssh -V writes its version to stderr, not stdout, so it may look separate from other output. ssh -G evaluates the config for the host and exits without connecting to it - that is the safety guarantee here: it shows exactly what SSH would do while doing nothing to any machine.
What you should see A listing of your SSH files: private keys, matching .pub public keys, known_hosts, and any config. The mode column shows the permissions - private keys locked to you, .pub files world-readable.
Note If you have never used SSH, ~/.ssh may not exist yet; an empty or missing directory just means no keys yet. Creating keys with ssh-keygen is the separate, state-changing step left out here. Note the permissions tie: SSH refuses to use a private key that other users can read.
Where each idea shows up in your output
Concept
Windows
macOS
Linux
Client version
ssh -V (prints to stderr)
ssh -V (prints to stderr)
ssh -V (prints to stderr)
What SSH would do for a host, without connecting
ssh -G example.com
ssh -G example.com
ssh -G example.com
Your keys and their permissions
Get-ChildItem $HOME\.ssh
ls -l ~/.ssh
ls -l ~/.ssh
The same ideas, as prose
These are the exact fragments the model serves — also available as an
ordered study guide.
Working on a machine that isn't in front of you
The computer you actually need to operate is often not the one in front of you. It is a server in a datacenter, a virtual machine rented from a cloud provider, a box humming in another building — somewhere you will never physically sit. SSH (the secure shell) closes that distance: it gives you a real shell on the remote machine, over the network, as if you had pulled a chair up to it.
What you get is not a watered-down remote view but the genuine command line of the other machine. You type, the command runs there, and its output comes back to you. Because that traffic crosses a network you do not control, SSH is built to be secure by default — the word in its name is not decoration.
The model on this page steps through what happens when you connect: the client reaching the server, the two machines settling who each other is, bringing up an encrypted line, and proving your identity, until a shell finally opens on the far end. Every packet and endpoint in it can be clicked to explain itself.
Client and server
SSH has two halves, and they are not interchangeable. On the remote machine a server program called sshd (the SSH daemon) runs quietly in the background and listens for incoming connections. On your machine the ssh client is the program you actually run; it reaches out and connects to that waiting daemon. Nothing happens until the client makes the first move.
Once connected, the trick worth holding onto is where the work happens. The shell you drive runs on the remote machine, not yours — every command executes there, against that machine's files and its processes. Your terminal is only the near end of a pipe: it ships your keystrokes across to sshd and prints back whatever the remote shell produces. You get the full command line of a computer that may be thousands of miles away, and the only thing traveling the wire is input going one direction and output coming the other.
An encrypted channel over an open network
On an open network an eavesdropper can read a plaintext connection's traffic in the clear, but SSH carries the same keystrokes and output as unreadable ciphertext, so the eavesdropper learns nothing.
To reach the server, the client needs two things: which machine to talk to and which door to knock on. The machine is a host — a name or an address — and the door is a port. SSH's default port is 22, so unless someone has chosen otherwise, that is where sshd is listening and where the client goes.
Reaching the server is only the start. Before anything sensitive passes — before you type a password, before a single keystroke of real work — the two sides agree on a shared secret and bring up an encrypted channel. From that point on, everything crossing the wire is ciphertext: your keystrokes, the command output coming back, and the credentials you log in with are all unreadable to anyone watching the network in between.
That is the whole difference from a plaintext connection, where the same traffic would travel in the clear for any router, wireless neighbor, or curious network operator along the way to read. The secure shell assumes the network between you and the server is hostile, and arranges things so that it does not matter.
Is this really the machine I meant?
Encrypting the connection only helps if you are encrypting it to the right machine. An impostor could sit in the middle, answer in the server's place, and cheerfully set up a perfectly secure channel — to itself. So before you trust it, the server has to prove which machine it is. It does this with a host key: one half of a public/private key pair that belongs to that specific server. The server keeps the private half secret and presents the matching public half to every client that connects, and only the machine actually holding the private key can back up that identity.
The hard part is the first connection: you have no prior record of this server, so you cannot yet tell its real key from a forged one. SSH handles this with trust on first use — the first time you connect, it shows you the key and asks you to accept it, and once you do, it writes that key down in a file called known_hosts. Every later connection is checked against the saved key. It works like recognizing a friend's voice on a phone line you have used before: the first call you take on faith, but ever after a stranger answering that same line is instantly, obviously wrong.
That saved key is what turns a silent risk into a loud one. If the key a server presents ever stops matching the one in known_hosts, SSH does not quietly carry on — it refuses, warning that the remote host identification has changed and that someone could be eavesdropping. Usually the server was simply rebuilt; occasionally it is exactly the attack the check exists to catch. Either way you are told, instead of being fooled.
Proving who you are with a key pair
SSH public-key authentication: the private key stays on the client and never crosses the wire, the public key sits on the server, and the client proves possession by answering a server challenge with its private key.
The server has proved which machine it is; now you have to prove who you are. The simplest way is a password, which SSH will accept over its encrypted channel. The far better way is a key pair of your own — the same public/private idea, turned around to point at you instead of at the server.
Here is the shape of it. You hold a private key, a file that never leaves your machine and that you never send to anyone. The server holds the matching public key, which is safe to hand out and safe to store — it lives in a file called authorized_keys on the server. When you log in, the server issues a challenge that can be answered correctly only by whoever holds the private key, and you answer it without ever transmitting the private key itself. You prove possession, not the secret. It works like a signet ring kept locked away and the wax seal it stamps: you prove a letter is yours by pressing a fresh seal anyone can recognize, never by handing over the ring itself.
Because the private key is the whole of your identity, how you store it matters as much as the cryptography. This is exactly the kind of file the permissions rules exist to protect: a private key that other users on your machine can read is a private key anyone on that machine can steal. SSH enforces this rather than trusting you to remember it — it will simply refuse to use a private key whose permissions let others read it, and tell you the file is unprotected. A key pair is only ever as strong as the secrecy of its private half.
More than an interactive shell
An interactive prompt is the most visible thing SSH gives you, but it is not the only one. The same secure connection can carry a single command instead of a whole session: you ask the remote machine to run one thing, it runs it and hands back the output, and the connection closes — no lingering prompt, just a question and an answer.
The same transport moves files, too. scp and sftp copy files to and from the remote machine over an ordinary SSH connection, using the same authentication and the same encryption as a login session — a file copy is just a different use of the secure pipe, not a separate, less-protected channel. Other tools lean on SSH the same way, riding its authenticated, encrypted transport rather than inventing their own.
It is easiest, in the end, to think of SSH not as a remote-login program that happens to be secure, but as a general-purpose secure connection between two machines. Logging in is only its most familiar use.
How every server gets operated
Almost every server you will ever run is a machine you never physically touch. The game server you stand up for friends, the box that hosts a service, the cloud instance you rent for an afternoon — you reach all of them the same way, by opening an SSH session to a computer you have never seen and may never see. Remote access is not a niche skill reserved for administrators; it is simply how servers are operated.
That makes these habits the professional baseline, not extras. The expected way to log in is a key pair, not a password typed over and over: it is harder to guess, harder to steal in transit, and it is what automated tools and deployment systems assume. And the private key that anchors your identity has to be locked down by permissions so that only you can read it — the same least-privilege thinking applied to the one file that is, in effect, the keys to the machine.
Learn to reach a remote box safely and keep its key where nothing else can read it, and you have the ground floor of running anything in production.