$ which reboot
/usr/bin/reboot
$ sudo reboot
Sorry, user myusername is not allowed to execute '/sbin/reboot' as root
What am I missing here?
$ which reboot
/usr/bin/reboot
$ sudo reboot
Sorry, user myusername is not allowed to execute '/sbin/reboot' as root
What am I missing here?
when you run a command as root, files inside the sbin folder have a higher priority than the other folders in your path. Thats why sudo chooses /sbin/reboot. You have to use /sbin/reboot in your sudoers file, or you have to explicitly call sudo /usr/bin/reboot
What this is telling you is that your sudo
rights do not include the ability to use the reboot
application. The PATH is not being modified; it can find reboot
just fine.
cat /etc/sudoers
, and modify with visudo
as necessary.
I think it has something to do with this question:
https://stackoverflow.com/questions/257616/sudo-changes-path-why
So sudo changes the path, but passes it unchanged to the command. So it uses /sbin/reboot for the reboot command, but passes the usual path to the which command (which consequently finds sudo in /usr/bin/reboot).