MYTHOSAI

Linux security / PRACTICAL GUIDE

Create and test an SSH key for Ubuntu access

Add key authentication first and verify it before removing password access.

Before you start

OpenSSH client, an Ubuntu SSH server and existing authorised access.

Keep the private key private

An SSH key pair has a private key on your client and a public key that can be authorised on the server. Copy the public key only. A passphrase helps protect the private key if its file is stolen, but it still needs careful storage and backup.

Create a distinct key

On a Linux, macOS or Windows OpenSSH client:

bash
ssh-keygen -t ed25519 -f ~/.ssh/mythosai_lab_ed25519 -C 'mythosai-lab'

Use an existing suitable key if your organisation already has a key-management policy. Do not overwrite it. Check that the destination directory exists. On Windows, PowerShell expands the home-directory path differently from a Unix shell; use the equivalent path under your user profile when needed.

Authorise the public half

On a Unix client with ssh-copy-id, use your actual username and server address:

bash
ssh-copy-id -i ~/.ssh/mythosai_lab_ed25519.pub adminuser@192.168.50.10

These are lab example values, not a command to run against an unknown device. If ssh-copy-id is unavailable, use the server's documented process to append the .pub file's single line to the target user's ~/.ssh/authorized_keys. Preserve existing keys.

Check permissions

On the server, the target user should own the SSH directory and key file. Restrict their permissions:

bash
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

Run those commands as the account whose keys you are configuring, not against an unrelated user's home. Incorrect ownership or overly broad permissions can cause the server to reject a key.

Verify the actual method

Keep your existing session open. In a new client session:

bash
ssh -i ~/.ssh/mythosai_lab_ed25519 -o IdentitiesOnly=yes \
  -o PreferredAuthentications=publickey adminuser@192.168.50.10

Confirm you reach the correct account and can perform the necessary authorised sudo action. Compare the server host-key fingerprint through a trusted route before accepting a new or changed host key. A changed fingerprint should be explained, not bypassed automatically.

Common mistakes

Copying the private file to the server creates unnecessary exposure. Installing a key for root when you meant a standard sudo user changes the access model. Disabling passwords before this new connection works risks lockout. Store an independent recovery route before moving to key-only access.

APPLIED FIELD GUIDE · NOVEMBER 2026

A production-safe cutover and rollback checklist

Changing an SSH authentication method on an internet-facing server is a change-control activity, not just a command. Before you touch password authentication, identify the exact administrative account, how the server is reached (local network, VPN or bastion), who has console access if SSH fails, and whether any automation still requires password-based access. Changing the wrong file or user can strand the operator.

Staged rollout

  1. Record the server version, current management addresses, current effective SSH settings and the approved maintenance window. Review the server's actual sshd_config and any sshd_config.d overrides.
  2. Generate the new key on the administrator's client device. Back up the private key according to policy. Never copy the private key to the server.
  3. Install only the public key for one named user. Check home-directory, ~/.ssh and authorized_keys ownership and permissions.
  4. Keep the existing SSH session open. Open a genuinely new session using the intended key and login name. Validate a required authorised management operation, not merely that a TCP connection opens.
  5. Confirm the server accepts public-key authentication under its effective configuration. On supported OpenSSH versions, test syntax with sshd -t and inspect effective settings with sshd -T using options appropriate to the user/connection context.
  6. Only after validating all legitimate users, automation and fallback access, consider changing password authentication. Maintain a tested console or provider recovery route.

How to interpret common failures

ObservationLikely avenue to check
Permission denied (publickey)Account name, client key selection, public-key installation, file permissions and server logs.
Connection times out before authenticationNetwork path, security group, firewall, SSH service listener or wrong destination; not necessarily a key problem.
Host key has changedIndependently verify server identity before trusting the new fingerprint. Do not automatically remove the old entry to suppress the warning.
Key succeeds from one device onlyLook for a different client configuration, agent and key file; do not disable working access to make devices identical.

Rollback record

Document how to reach the provider console or local virtual console, which configuration files will be restored, who has permission to restart SSH, and how you will prove the management path works after rollback. Use a temporary non-production host to practise first if this is your only route to a critical system.

Official references

Consult the current vendor documentation if your version or screen differs.

Documentation-based draft. Commands have not all been executed against the named products in a lab. Validate configuration examples against your installed version before changing a working system.