`sudo reboot` vs `reboot` - what is the difference?
On Ubuntu 14.10 and older, sudo
is required.
The introduction of Systemd in 15.04 changed the way Ubuntu handles shutdown
and reboot
:
When a single user is logged in,
sudo
isn't necessary. When more than one user is logged in thensudo
is required.Applications can inhibit
shutdown
andreboot
. You override these inhibitions withsudo
.A single user logged in via
ssh
still requiressudo
.
On my 14.04 machine, when I (as a normal user) type reboot
, I get
reboot: Need to be root
That is the difference.
As Terrance pointed out in the comments, it works differently on later systems than mine. So you are probably seeing old writeups and/or users (like me) who have been habituated to typing sudo reboot
!
sudo reboot
is used in tutorials / how-tos for compatibility reasons
While reboot
might work
- if you are root or
- if you are on a host with
systemd
and - if no applications are blocking a reboot
sudo reboot
will "always"* work, regardless of
- whether you are root
- whether there are other users logged in
- whether there are applications blocking
- whether init is systemd, System V, Upstart, whatever
* Well, it will certainly try - short of there being some kernel processes that are blocking/misbehaving it should work.