SSH Authorized Keys ForcedCommand and Wrapper Audit
Once you have access, you check whether SSH access control is being altered via authorized_keys options or server-side forced commands.
This is not about adding persistence. It’s about detecting it, documenting it, and understanding why SSH behavior differs per user.
Check per-user authorized_keys options
The risk pattern is authorized_keys entries with restrictive or unexpected options, especially command=. Those options change what happens when a key authenticates.
On a host where you have filesystem access:
If you can enumerate other users after privilege gain:
If you find command=, capture the full line in notes. That’s the control point.
Check sshd server-side forced command policy
Server-wide forced commands override interactive shells and can make SSH sessions behave inconsistently across users.
Also check config and Match blocks:
References
-
sshd_config(5) manual pageman.openbsd.org/sshd_config (opens in new tab)
ForceCommand, Match blocks, AuthorizedKeysCommand, and forwarding controls.
-
ssh(1) manual pageman.openbsd.org/ssh (opens in new tab)
Client behavior when forced commands and restricted sessions are in play.
Was this helpful?
Your feedback helps improve this page.