It seems as if most Linux systems use either /sbin/nologin or /bin/false as the default shell for service accounts. Many hardening guides, such as CIS benchmarks, recommend changing the default shell for these accounts to /dev/null. While many recommendations have an anslysis attached, this is one that I have never seen justified. What concerns are driving this recommendations and what threat it is attempting to mitigate?
|
|
|||
|
|
|
The only true technical reason I'm aware of is the possibility of malicious file substitution. Consider an attacker who finds a way to write to arbitrary files. If they can overwrite /sbin/nologin or /bin/false with a copy of /bin/bash, then they can conceivably find a way to log in as a service user and continue to elevate their privilege from there. However, /dev/null cannot be trivially replaced in such a manner, for various reasons:
There is also a non-technical reason, which is that many administrators are bound by tradition and/or the habits they learned long ago, and /dev/null was once a more common choice for this use (I'm pretty sure /sbin/nologin didn't exist 20 years ago). Make of that what you will. |
|||||||||||||
|
|
I'm no Linux guru, but if I compare this to recommendations for service accounts on Windows, I think this is comparable to removing all privileges, including the possibility for interactive logon.
|
|||
|
|
|
Great question! As far as I know, there is no justification for this advice. As far as I know, it is bad advice; |
|||
|
|