Welcome to the Linux Foundation Forum!

Minor misinformation in Lab Exercise 1.1 (regarding use of sudo)


The sudo command does NOT inherit the PATH of the non-root user, from what I can tell. sudo gets its path from the secure_path parameter in /etc/sudoers. Anything outside this path requires a preceding absolute or relative path, or else sudo can't find the command.

Imagine a command, /usr/local/sbin/my_command. If my non-root user has /usr/local/sbin in $PATH, the following command will NOT run:

sudo my_command

I'd have to either run it with the full path to my_command:

sudo /usr/local/sbin/my_command

Or add /usr/local/sbin to the secure_path in sudoers:

Defaults        secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin


Upcoming Training