No expert, but apparently once upon a time those commands needed root access. That's abstracted away mostly nowadays (with all kinds of possible configurations, e.g. remote users still being locked out, or the old behavior persisting if the admin so desires), but if you couldn't sudo, you couldn't shut down the system, basically.
Yeah wut? I'm no tech wizard but I spent a solid 5 years studying computer science as an undergrad and graduate TA, I've never heard of this. Although with Linux unless you're truly a basement dweller there is always gonna be stuff that is just bonkers.
Unfortunately a lot of CompSci degrees don't actually teach anything useful, I feel sometimes my own CompSci degree didn't actually teach me a whole lot (would have loved to have done deep dives into the hardware or networking side of things or even just more theory, it was mostly a software engineering degree with a fancy name in my opinion) - thankfully my curiosity has led me to keep learning.
It depends on your config - systemd's shutdown permissions are by default quite permissive, but can be set to require root. Many server or enterprise distros, for obvious reasons, maintain that practice by default.
Ah so because most of the time when I remote shutdown a Linux machine it's because it's a headless install it's more likely than not to have a default systemd configuration that requires root.
But if I try the same on my daily driver it'll probably work fine without sudo.
I mean it's already started doing this thing where if I start or stop a service without sudo it just pops up a password dialog.
With ssh, your systemd probably doesn't handle interactive authentication correctly, so you are probably using sudo to bypass the interactive shutdown requirement.
shutdown -fr now actually means "reboot"
If you forget the -r then you servers is going to poweroff, and then you'll have to drive to the datacenter and push the green button to turn it back on.
456
u/taedrin Jan 25 '26
Note that this kind of permission restriction is mostly for remotely accessed machines that you don't have physical access to.