SSH as a Sudo Replacement
Scope of the Idea
- Discussion centers on using a local SSH daemon (often on a Unix socket) as a replacement for
sudo/setuid, not about exposing root SSH over the internet. - Several note this is conceptually similar to
systemd’srun0and earlier work (e.g., LISA papers).
Security Model: SSH vs sudo/su
- One camp argues logging in directly as root via SSH (with keys) can be strictly more secure than user→sudo:
- Fewer accounts that can escalate.
- Avoids setuid binaries exposed to all users.
- Reduces attack surface from user processes, daemons, and cron jobs that might have sudo access.
- Others push back:
sshdis larger and more complex thansudo; more code can mean more bugs.suandsudoare also setuid but simpler than sshd; if the goal is less code,su/doasmay be better.- SSH still has to handle environment, files, and sockets, so the “smaller surface” claim is disputed.
Setuid and Privilege Escalation
- Supporters emphasize the benefit of removing setuid/setgid entirely; elevating privileges is hard to secure in Unix.
- Critics respond that something must elevate privileges anyway; setuid isn’t uniquely bad, just another mechanism.
- Some highlight environment-based attacks on setuid/sudo (PATH, LD_PRELOAD) vs more “obvious” network data handling in daemons.
Auditing, Policy, and Usability
- Many value
sudofor:- Fine-grained command control and argument restrictions.
- Per-user auditing and accountability.
- SSH-based root sessions lose this granularity unless combined with
ForceCommandor related tricks, which are less flexible. - Several admit to using
sudo bashand regretting poor audit trails, but still seesudoas better for policy enforcement.
Complexity and Operational Concerns
- Critics view “SSH as sudo” as added complexity and technical debt: extra daemons, sockets, crypto, and edge cases.
- Concerns raised about:
- Single-user/recovery mode when root password is disabled.
- Boot-time failures of sshd leaving the system inaccessible.
- Some argue that in modern immutable/golden-image setups, any interactive root shell (via SSH or sudo) is itself a failure mode.
Key Management and Access Control
- Central question: how to handle multiple admins?
- Sharing root keys is discouraged; per-user keys plus SSH certificates are suggested but add management overhead.
- Traditional
wheel/sudogroups andsudoersrules are seen as simpler for many environments.