0

When I switched to root user using su command, I still need to use sudo reboot instead of reboot to reboot the system, otherwise bash returns

bash: reboot: command not found

Why is that the system would not look for executables in sbin/ directories for root user automatically?

  • 3
    Because you do not have in PATH of root /sbin. Add it and voila. – Romeo Ninov Jun 13 '23 at 14:47
  • But why doesn't root have those /sbins by default? Isn't it supposed to be able to execute any commands without sudo? – Yiyang Yan Jun 13 '23 at 14:57
  • Second time: check PATH variable. Why you do not have it we do no know. – Romeo Ninov Jun 13 '23 at 15:01
  • You are able: /sbin/reboot and voila. It worked. The problem is not that you can't execute it, the problem is that your shell can't find an executable when you type just "reboot". It needs to be told where to look for commands. How exactly did you gained the root shell? Are you sure it executed root's shell profile when you entered the shell? – Nikita Kipriyanov Jun 13 '23 at 15:13
  • 3
    Use su - instead of only su. Have a look at man su(1). – Oliver Knodel Jun 13 '23 at 15:37

0 Answers0