SSH
SSH gives you a shell on a machine that is not yours, and the whole protocol is one question asked twice — who is the server, and who are you?
Introduction
SSH means Secure Shell, and it lets you connect to another machine through a remote shell.
Once you’ve connected, every command you type in the terminal is sent to the remote server and executed on that machine, not on yours.
That is a strange thing to hand a stranger.
You are about to type your password into a program that will send it down a cable, to a machine you have never seen, in a room you cannot visit.
So before it lets you do anything, SSH asks the same question twice, in both directions:
- Is that machine really the server I asked for?
- Are you really the user you say you are?
Almost everything on this page is one of those two questions being answered.
The first one is answered by a host key, and the second one by your key.
Environment
You need two machines: one to connect from (the client) and one to connect to (the server).
Both are box machines on your PC, from box, on the host-only network 192.168.56.0/24 where they can already see each other.
The server
box create server
server: import
box ip server
192.168.56.16You never open a window on this machine. That is the point: a server has no screen — you reach it over the network and nothing else.
The client
Everything with a $ prompt from here on is typed on a second machine, the client. That is kennel, the machine from Server:
box ssh kennelEverything with a > prompt is typed in PowerShell on your own Windows machine, where the box command lives.
The password
box puts your key in the server already, which is what you spend the page learning to do by hand. So for the lesson, the server is set back to the state a real one starts in: it only lets you in with a password.
Both machines carry a box user with the password password. On the server, password login has been turned on again so you can experience the first connection the way you will on a machine that is not yours.
Check the two machines can reach each other:
kennel
PING 192.168.56.16 (192.168.56.16) 56(84) bytes of data.
64 bytes from 192.168.56.16: icmp_seq=1 ttl=64 time=2.37 ms
--- 192.168.56.16 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 2.374/2.374/2.374/0.000 msKeep reading — it's free.
The rest of this page is open to anyone with a free account. It costs nothing and takes one click: the account exists so we know who agreed to the terms.
Create a free accountYou will be asked to accept the Terms · Privacy Policy