What is the point of osmc-no-secure-path? It makes the user have to type the full path of sudo-only commands, which I always forget because all my other machines have it.
Can you give an example?
Basically any command on /usr/sbin. The one that trips me most often is reboot
sudo reboot works fine for me, as does sudo -s and then running reboot.
I had a file named /etc/sudoers.d/osmc-no-secure-path with content
Defaults !secure_path
Was it not supposed to be there? Or do you have /usr/sbin on your $PATH? I checked /etc/skel there’s no line adding it
The file should exist, and the reboot command should work just fine. Perhaps you’ve changed something else on your system to cause this issue.
By disabling the secure path option, the PATH is preserved when escalating privileges, so /sbin stays in PATH.
osmc@osmc:~$ sudo -s
root@osmc:/home/osmc# echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin
root@osmc:/home/osmc#
But is sbin in your user’s PATH? Because it is not in mine, nor in skel’s.
Yes.
I think that was changed in Debian in Bullseye. Why did you add the osmc-no-secure-path?
As explained, it’s so that PATH is preserved when escalating privileges. This is to make sbin available as part of PATH when running as root.