CONSIDERED INFRASTRUCTURE. INDIVIDUAL PROPOSALS.alonzofelixa@alonzo.cloud
HELP CENTER / Getting started

Connect with SSH and verify a key-based administrator account

Establish a trusted SSH connection while preserving working access and proving that the intended administrator can use sudo.

By ALONZO & ALONZO, LLCPublished Updated

Applies to Authorized access to an existing Linux VPS; account-creation commands below are specific to Ubuntu.

Before you begin

  • A verified server fingerprint, authorized initial access, and the documented client-facing SSH endpoint.
  • An OpenSSH client; Windows users can check whether the OpenSSH Client component is installed.
  • For account creation, existing authorized root or sudo privileges and a preserved original session.

Separate the external endpoint from the guest listener

Replace every uppercase placeholder before using a command. SERVER_HOST is the authorized hostname or address, SSH_USER the existing login account, and SSH_PORT the verified numeric port used by your client. Do not guess these values. Under NAT or forwarding, GUEST_SSH_PORT is the actual SSH listener inside the guest and may differ from SSH_PORT.

This guide does not change either port or enable initial root access. Obtain missing connection details through an independently trusted administrative channel. Do not post passwords or private keys while requesting them.

Prepare your local terminal and choose an authorized login method

On Windows, open PowerShell or a PowerShell tab in Windows Terminal; on macOS or Linux, open Terminal. These are local client commands. Run ssh -V to check OpenSSH availability. If missing, install the official client for your operating system before continuing.

If the existing account is authorized for password login, use:

ssh -p SSH_PORT SSH_USER@SERVER_HOST

Verify the host fingerprint as described next before entering credentials. Password entry is invisible: no characters or asterisks appear; type it and press Enter. Do not enable password login merely for this example. After login, commands run remotely on the VPS; open a separate local terminal for key creation and transfer.

For key-based access, reuse an approved key or create a new one locally. Replace KEY_FILE with a new client-side file path and KEY_LABEL with a non-sensitive label:

ssh-keygen -t ed25519 -f "KEY_FILE" -C "KEY_LABEL"

Use a passphrase; never overwrite an existing key unknowingly. The private key stays on the client; only KEY_FILE.pub is installed remotely. Keep a protected recovery copy. These are instructions, not tests performed on your VPS.

Verify the host before sending credentials

For the key-based branch, connect from a local client terminal using the documented endpoint:

ssh -p SSH_PORT -i "KEY_FILE" SSH_USER@SERVER_HOST

Compare the complete displayed host-key fingerprint with one obtained independently from a trusted administrator or an already verified recovery console. An authorized person with trusted guest access can inspect the relevant public host key, for example:

ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub

Match the algorithm as well as the fingerprint. If identity is unknown or a saved key has changed, stop. A rebuild can explain a change but is not proof. Do not bypass checking or blindly remove saved host-key entries.

Create an administrator only with existing authority

If a suitable Ubuntu account already exists, use it rather than creating another. Otherwise, replace ADMIN_USER with the approved new username and run these commands from an existing authorized sudo session:

sudo adduser ADMIN_USER
sudo usermod -aG sudo ADMIN_USER

An authorized root shell omits sudo. Creating users or changing groups requires that authority. Where your client supplies ssh-copy-id and the new account has an approved initial authentication method, install only the public key:

ssh-copy-id -i "KEY_FILE.pub" -p SSH_PORT ADMIN_USER@SERVER_HOST

Windows clients may not include this utility. In that case, use the trusted session to install the public key in the new account's ~/.ssh/authorized_keys, preserving existing entries, correct ownership, and restrictive directory and file permissions.

Prove the new login and sudo in a second session

Keep the original connection open. In a separate client terminal, explicitly use the new account and key:

ssh -o IdentitiesOnly=yes -p SSH_PORT -i "KEY_FILE" ADMIN_USER@SERVER_HOST

Inside that new session, run:

whoami
sudo -v
sudo id -u

The username must be the intended account; the final command must report 0. Group membership is evaluated at login, so an older session may not have the new privileges. Do not disable password authentication or root login until this independent key-based login and sudo both work. This guide does not make those configuration changes.

Record the verified outcome without exposing access

Success means the expected server identity was verified, the intended key-based account can open a fresh connection, and authorized privilege elevation works. Record which public-key fingerprint is approved and where the protected private key is held, without copying the key itself into notes.

If escalation is needed, retain the exact error, UTC time, client version, authentication method, and whether the external and guest ports differ. Share only redacted excerpts through an authorized channel. Remove usernames, addresses, internal paths, account identifiers, and sensitive banners as necessary. Never send a password, passphrase, private key, or an unreviewed terminal transcript.

Final checklist

  • The client-facing host and SSH_PORT were verified rather than guessed.
  • The complete host-key fingerprint was independently checked.
  • The private key remains on the client and only the public key was installed.
  • A second key-based administrator login and sudo both succeeded before any access restrictions.
  • The original session remains available until verification is complete; escalation notes are redacted.

Sources & further reading

YOUR NEXT STEP

Discuss your requirements.

For a VPS proposal, share your workload, preferred region and resource needs. Availability, specifications and terms are confirmed separately; an inquiry does not place an order or provision a server.

Start an inquiry