`sudo reboot` vs `reboot` - what is the difference?
I recently found out that reboot
works just as well as sudo reboot
, from what I can tell. However, in a lot of instances, I see people saying to sudo reboot
. Why is this? Are they the same, and just personal preference? Or are they different? Does sudo reboot
do more than reboot
?
Solution 1:
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
.
Solution 2:
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
!