Linux – Why doesn’t sudo -i respect the sudoers file

linuxsudo

To ensure the proper PATH environment variable is setup, I am using the sudo -i options, but am finding that the sudoers file isn't being respected.

Here is my setup:

/etc/sudoers:

Defaults    env_reset

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL) ALL
user    ALL=(ALL) ALL
user    ALL=NOPASSWD: /usr/local/bin/chef-solo

Running sudo chef-solo -v doesn't prompt for a password. Running sudo -i chef-solo -v will prompt for a password.

Best Answer

sudo -i executes your shell, not the command. It passes the command to the shell.