[sudo-users] sudo -i: "cannot execute binary file" or password prompt

Fabiano Sidler lists at fipscode.ch
Tue Apr 21 15:30:55 EDT 2009

Hi folks!

In my sudoers, I have the following (as the last) line:

  foo ALL=(ALL) NOPASSWD: /usr/local/bin/bash /usr/local/bin/bar

While this works well, when /usr/local/bin/bar is a shell script

  foo$ sudo -i /usr/local/bin/bar

I'd also like it to work with any executable. So far, when I try it with
a binary, sudo says

  /usr/local/bin/bar: usr/local/bin/bar: cannot execute binary file

Appending '-- -c' to 'sudo -i', or omit "/usr/local/bin/bash" in sudoers,
it prompts for password, which I don't want.

How can i run 'sudo -i /foo/bar' as if /foo/bar were a shell script?
And yes, bash is the login shell of user foo and I definitely need login
environment for the user when running the command.

Thanks in advance for replies!


More information about the sudo-users mailing list