C.W.K.
Stream
Lesson 02 of 12 · published

First Connection

~15 min · ssh, first-connection, fingerprint, ssh-dir

Level 0Pinger
0 XP0/101 lessons0/12 achievements
0/150 XP to next level150 XP to go0% complete

The basic command, and what really happens

The simplest SSH invocation is just ssh username@host. The first time you connect to a host, SSH does something important: it shows you the server's host-key fingerprint and asks if you trust it. Saying yes saves the fingerprint into ~/.ssh/known_hosts, and from then on SSH verifies that the server hasn't been swapped under you.

The first-time prompt

You'll see something like:

The authenticity of host '192.168.1.100 (192.168.1.100)' can't be established.
ED25519 key fingerprint is SHA256:xR4kL9mN2pQ7vW3jH8fT5bY6cZ1dE0gA.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

This is TOFU — Trust On First Use. You're saying "I trust this fingerprint is the real server." Ideally, you've already verified the fingerprint through a different channel. In a small home/office fleet, you typically just type yes.

The ~/.ssh directory

All SSH client state lives in ~/.ssh/:

FilePurpose
~/.ssh/configYour client config (Track 3 covers this in depth)
~/.ssh/id_ed25519Your private key (KEEP SECRET)
~/.ssh/id_ed25519.pubYour public key (safe to share)
~/.ssh/known_hostsFingerprints of servers you've connected to
~/.ssh/authorized_keysPublic keys allowed to log in (server side)

Code

Your first connections·bash
# By IP
ssh you_username@192.168.1.100

# By mDNS hostname (works on the same LAN)
ssh you_username@office.local

# Non-default port
ssh -p 2222 you_username@192.168.1.100

# Drop a single command and exit (no interactive shell)
ssh you_username@office.local 'uptime'

# Set up the .ssh directory if it doesn't exist
mkdir -p ~/.ssh
chmod 700 ~/.ssh
ls -la ~/.ssh/

External links

Exercise

Pick one machine on your LAN you've never SSH'd into. Run ssh -v user@that-host. Skim the verbose output and identify: (a) which auth methods the server offers, (b) which key files your client tries, (c) whether the host key got added to known_hosts. The verbose output is a short documentary of what SSH actually does — read it once and a lot of future debugging stops feeling like guessing.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.