[sudo-users] Passing password to sudo

Fabiano Sidler lists at fipscode.ch
Tue Apr 21 17:47:20 EDT 2009

On Tue, Apr 21, 2009 at 02:28:29PM -0700, Alex Chen wrote:
> Is there a way to invoke sudo so that the password can be passed as a 
> command line parameter instead of manually typing in?

No. And probably won't be ever, because so, the password could be retrieved
by other users via 'ps' and such tools.

> We want to use 'sudo' to execute scripts under certain user's name 
> programmatically, e.g. launch sudo via 'exec', and pass the user's password
> directly to sudo non-interactively.

Use the sudoers NOPASSWD feature, if you really need to. SUID bit don't work
for scripts, actually.

> We looked at the sudo man page but could not find anything that allows 
> us to do so.

Because of security reasons, see above.


More information about the sudo-users mailing list