Sudo notes


Jump to: navigation, search

sudo ignores current directory in PATH by default

  • By default, the current directory in a user's PATH is ignored.
       ignore_dot  If set, sudo will ignore ’.’ or ’’ (current dir) in the
                   PATH environment variable; the PATH itself is not modified.
                   This flag is on by default.  Currently, while it is possi-
                   ble to set ignore_dot in sudoers, its value is not used.
                   This option should be considered read-only (it will be
                   fixed in a future version of sudo).


$ sudo -l
User hutchib may run the following commands on this host:
    (ALL) NOPASSWD: /files1/AdventNet/ME/*/bin/*
    (ALL) NOPASSWD: /etc/rc.d/init.d/netflowanalyzer
    (ALL) NOPASSWD: /sbin/service netflowanalyzer *
$ cd /files1/AdventNet/ME/NetFlow/bin
$ sudo ./
(Prompts for password)
$ sudo

As a workaround, make sure the appropriate directories are in your PATH and execute the command without the ./

$ PATH=$PATH:$(pwd) sudo
(Works without prompting for password)
Personal tools