Bugzilla – Bug 434
sudo -i requires login shell entry in sudoers
Last modified: 2010-08-31 07:24:33 MDT
# tail -1 /usr/local/etc/sudoers joeuser ALL=(root) NOPASSWD:/usr/bin/echo $ whoami joeuser $ sudo /usr/bin/echo hello hello $ sudo -i /usr/bin/echo hello Password for joeuser (sudo): Sorry, user joeuser is not allowed to execute '/bin/bash -c /usr/bin/echo hello' as root on is5.nyc.deshaw.com. Shouldn't the command check be against /usr/bin/echo?
That behavior is correct. The only way to run a command with the a login-style environment is to run it via a login shell. The -i flag is really just shorthand for doing that. Since the login shell may be influenced by the environment or by flags passed in it would not be secure to allow any user to run any command via "sudo -i" unless they are explicitly allowed to run it via the shell.