Track Activity of SSH

Published
Length
3 min read

Luis Felipe Dias

All posts

You can track activity of ssh by pairing OpenSSH user certificates with host system logs. This setup ties every login event to a signed user identity on the target server. Most teams start by sharing static public keys across their Linux hosts. Static keys make it hard to see which person ran a command on a shared account. When roles stay too broad, any user with a key can alter logs or hide actions. How to track activity of ssh with OpenSSH certificates OpenSSH lets you sign public keys with

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.

You can track activity of ssh by pairing OpenSSH user certificates with host system logs. This setup ties every login event to a signed user identity on the target server. Most teams start by sharing static public keys across their Linux hosts. Static keys make it hard to see which person ran a command on a shared account. When roles stay too broad, any user with a key can alter logs or hide actions.

How to track activity of ssh with OpenSSH certificates

OpenSSH lets you sign public keys with a central Certificate Authority key. A signed certificate holds a public key, an identity string, principal names, and options. OpenSSH uses a much simpler certificate format than the X.509 format used in TLS. When a user logs in, the SSH daemon checks the certificate against the trusted authority key.

The daemon then writes the key identity and serial number into the host system log. This log entry links the shared system user back to a specific person on your team. You can also set a validity window when you sign the user certificate. If you do not set a window, the certificate stays valid forever by default. Short validity windows force users to get a fresh signature before their next shift.

Teams often place a bastion or jump host in front of private servers. Engineers log in to the jump host first and then reach the target machine. Central log tools collect login records from both the jump host and the target servers. This gives security teams a clear timeline of who entered each host and when.

Where native SSH logging hits its limits

Native OpenSSH logs and certificates solve the problem of proving who logged in to a server. They record the start of a session, the key identity, and the matching principal name. They also let admins lock down which user accounts a certificate can reach.

Still, login logs do not show what happens inside an interactive shell session. Once the server grants a shell, the SSH daemon stops inspecting the traffic inside that tunnel. A user can run destructive commands, read private files, or copy sensitive data without triggering SSH alerts. If the user has root rights on that host, they can even stop the local log daemon.

DPoP (Demonstration of Proof-of-Possession) + SSH Access Management: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Some teams try to fix this by adding shell history files or kernel audit rules. Shell history is easy for a user to turn off or edit before logging out. Kernel audit rules create huge log volumes that are hard to read during an incident. You still lack a clean way to control individual commands in flight or mask sensitive output.

Why command-level visibility matters for production hosts

Modern security audits ask for more than just a list of server login times. Auditors want to know exact commands run during a session and what data returned. When an engineer debugs a live server, standard output might print emails, phone numbers, or card numbers. Native SSH pipes that raw text straight to the user terminal with no filtering.

Closing this gap requires moving checks from the login step to the command execution step. Instead of giving out broad shell access, teams need a way to review commands before they run. They also need logs that stay safe even if a user has root rights on the target.

Add command and file guardrails to SSH access

Host firewalls and certificate principals control who opens an SSH session. Yet an allowed user or agent can still run a bad one-shot command or pull sensitive files over sftp. In practice, hoop.dev sits inline on the host as an open-source SSH server with guardrails that uses OpenSSH certificates. For every one-shot command or sftp task an agent or human runs in production, hoop.dev decides to pass, mask, block, or escalate it for review.

Using hoop.dev SSH controls, guardrails check one-shot commands, env variable names, and sftp or scp paths before they run. Port forwards default to deny unless the target is listed. Because interactive shells have no statement boundary and carry no guardrails, teams can turn them off so every command is checked and logged. Check out the MIT-licensed project on GitHub.

Frequently asked questions

Does OpenSSH log every command a user runs by default?

No, OpenSSH logs login events, key identities, and session start or end times. It does not record interactive shell commands run after the login step finishes.

How do OpenSSH certificates improve audit trails over static keys?

A certificate includes a signed identity string that the server writes to the system log. Static keys only show which shared system account logged in, not which person used the key.

Can a root user change local SSH logs on a Linux host?

Yes, a user with root rights on a host can edit local log files or stop logging. You must ship logs off the host in real time or capture activity outside the target server.

The query runs. The emails stay hidden.