Tracking SSH Sessions

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams start tracking ssh sessions by matching system login logs to unique user identities. OpenSSH certificates let you tie every server login to a specific person. Many teams first share static keys or use one shared admin account. Shared keys make it hard to see who logged into a host. When permissions are too broad, anyone with the key can run any command. You cannot tell which engineer made a change during an outage. How tracking ssh sessions works with OpenSSH certificates OpenSSH added

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Teams start tracking ssh sessions by matching system login logs to unique user identities. OpenSSH certificates let you tie every server login to a specific person. Many teams first share static keys or use one shared admin account. Shared keys make it hard to see who logged into a host. When permissions are too broad, anyone with the key can run any command. You cannot tell which engineer made a change during an outage.

How tracking ssh sessions works with OpenSSH certificates

OpenSSH added certificate support for users and hosts in version 5.4. An OpenSSH certificate uses a much simpler format than standard web certificates. Your team creates a central Certification Authority key to sign user public keys. The signed certificate holds the public key and clear identity details. It also holds a list of allowed user or host names called principals. You can also add specific certificate options and a strict time limit.

When an engineer logs into a server, the server checks the certificate signature. The server trusts any key signed by your central authority key. It then writes the key identity string straight into the host log. This setup stops teams from copying raw public keys to every single machine. You no longer have to clean up old keys when someone leaves. You set a short validity window so the certificate expires on its own. By default, certificates stay valid forever unless you set a time limit.

How bastions and host logs work together

Many teams also route all server traffic through a central bastion or jump host. Engineers log into the jump host first before reaching internal servers. This layout gives your team one single point to collect login logs. You can ship those host logs to a central log store for review. Combining signed certificates with a bastion makes login tracking much cleaner. Every entry in the log shows the exact user identity from the certificate. Security teams can see when a session started and when it ended.

What native SSH logging solves and what it misses

Certificates and host logs solve the problem of knowing who logged in. You get a clear record of the user identity and login time. You also know which principal name they used to enter the machine. This is a big step up from shared static keys.

SSH Session Recording + Data Lineage Tracking: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Still, native login logs only check the door at the start. Once the shell opens, the server does not track each command in flight. If three engineers log in as the root principal, host logs blur together. A standard login log will not show who deleted a file. It will not stop a user from reading sensitive phone numbers or emails. Native certificates decide who gets in, not what commands do inside the session. Teams often try to fix this by reading shell history files on disk. Yet an admin with root rights can edit or delete those history files.

Check SSH commands and file transfers on the host

OpenSSH keys and certificates decide who can log into a Linux host. They do not check what a one-shot command or file transfer does once the session starts. With hoop.dev, you run an open-source SSH server with guardrails on the host. It checks callers with OpenSSH certificates and works with ssh, sftp, scp, and rsync clients.

When a caller runs a one-shot command or moves a file, hoop.dev guardrails check the command or path before it runs. Then hoop.dev data masking masks matched sensitive patterns in downloads and output. Interactive shells carry no guardrails because keystrokes have no statement boundary. Teams can turn interactive shells off and allow only commands and file tasks. The audit trail logs who connected and what was allowed or refused, without storing keystrokes or file bytes. See the source on GitHub.

Frequently asked questions

How do OpenSSH certificates help identify users in logs?

When you sign a key, you attach a unique user identity string. The server writes this identity string into the system log at login.

What happens if you do not set an OpenSSH certificate expiration time?

If you skip the validity window setting, the certificate stays valid forever. Teams must set a clear start and end time during signing.

Why do shared Linux accounts make command tracking hard?

Multiple users often log in under the same shared admin principal name. After login, the operating system runs all their commands under that single user ID.

The query runs. The emails stay hidden.