Your first SSH login: recognising your server
A user key grants login; a host key helps verify the other end of the connection.
On the first SSH connection, the client displays the server key’s fingerprint and asks whether to trust it. Typing yes is easy. The harder question is how you know that this key belongs to the intended VPS.
A password or a user’s personal key proves the user’s right to log in to the server. A host key works in the other direction: it helps the client verify the server. These are two different sides of the connection. A successful login does not replace verification of the remote identity.
Finding the expected fingerprint
Before connecting, establish a separately authenticated way to obtain the host key. For a VPS, this might be the provider’s console, provided you know it opens the machine you ordered. Panel authentication, selecting the correct VPS, and the console’s provenance also deserve attention. A label bearing the server’s name is not cryptographic evidence.
For a hypothetical system with an Ed25519 key, the following command reads its public key’s fingerprint through an already verified console. Run it only in your own authorised environment; the file’s presence depends on configuration.
ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub
The ssh-keygen manual documents fingerprint output with -l. The private key file is unnecessary. Compare the same key type and fingerprint representation: a server may have several keys, and the client may offer one of them.
A host key and its fingerprint are not secrets like a private key. However, an internal record connecting them to an address and administrative route need not be public. Public explanations can describe the method without that internal mapping.
What initial trust achieves
TOFU, or trust on first use, remembers the accepted key. The client can then detect later changes. But if the first endpoint was wrong, consistently repeating that decision will not make it correct.
Reading a key with ssh-keyscan does not provide independent verification either. It collects the network’s answer. If the expected value comes through the same unverified route, you are effectively comparing two copies of one response.
The SSH client configuration manual describes StrictHostKeyChecking and the known_hosts store. Preserve strict checking: automation should not silently accept any changed key simply to keep a task moving.
| Situation | Action before proceeding |
|---|---|
| Key type and fingerprint match an independent record | Save the verified key and verification date |
| No expected value exists | Obtain it through a trusted administrative channel |
| Values differ | Stop the login and investigate |
| The VPS was reinstalled | Independently verify the new key |
Prepare the record before the yes prompt
Organise comparison before opening the SSH client. Once the trust prompt appears, removing an obstacle can easily replace the real goal of verifying the server. A working record needs the object being checked, expected key type, fingerprint, source, and date. Include a clear reason why that source corresponds to this particular machine.
Suppose an administrator opens the intended test VPS console and obtains its Ed25519 fingerprint. The SSH client then displays a different key type. That does not yet establish substitution: these might be different keys belonging to the same server. Equally, it is not a match. Obtain the expected value for the offered type or deliberately configure the client according to the chosen policy.
Do not fill gaps in an incomplete record with guesses. A fingerprint without a clear algorithm or provenance is difficult to compare reliably. If another person sends the value, verify their identity and understand how they obtained the evidence. Forwarding a message does not make it an independent source merely by changing the sender.
E-01 in practice after host-key verification
During the initial inspection, password-based root login to E-01 worked using a previously independently verified ED25519 host key. Once inside the system, I read the user identifier:
id -u
0
The value 0 confirmed root privileges in this session. Host-key verification established trust in the server’s SSH identity; id -u identified the user after login. These observations serve different purposes.
Before future access changes, I also checked the SSH configuration:
/usr/sbin/sshd -t
The command exited with code 0 and no stdout or stderr: the syntax check passed. I then read the effective settings:
/usr/sbin/sshd -T
The following lines were selected from the complete response:
port 22
permitrootlogin yes
pubkeyauthentication yes
passwordauthentication yes
I did not provide a connection context with -C for sshd -T. The sshd documentation explains that this context allows the corresponding Match rules to be applied. The output above therefore does not test every access condition for a particular client.
I did not change SSH settings here. A separate administrator, verification of a new login for that account, and root restrictions remain future steps; a successful root session does not establish those results.
When machine replacement was planned
For a hypothetical reinstall, record the expected identity change in advance. Afterwards, the old key remains useful historical evidence, but verify the new one through the current console. Keeping the website name or IP address does not justify silently inheriting trust.
If an unwanted change is suspected, do not send new secrets to the remote endpoint until the cause is understood. Recording the warning and independent confirmation helps distinguish an administrative event from an unexplained deviation. Verification ends in an explained decision, not merely the disappearance of a client message.
A changed key needs an explanation
Reinstallation, machine replacement, or planned rotation can legitimately change a key. Confirm that explanation instead of assuming it. Removing an old known_hosts entry suppresses the warning but does not establish that the new key is correct.
First check whether the expected administrative event occurred, whether the address changed, and whether the correct object is open in the panel. Then compare the new key through an independent route before updating local trust. Keep a short explanation of the replacement so the next check does not start from assumptions.
If the independent channel is unavailable or the new key’s provenance is unclear, postpone administrative work. This is a concrete stop condition: there is no reliable answer to who is at the other end of the connection.
Verifying the key provides a limited but important result: the client sees the expected SSH identity. System state, administrator privileges, and product readiness require separate checks afterwards.