[sudo-users] Unable to change user in script

Aaron Spangler aaron at spangler.ods.org
Thu Aug 5 13:07:17 EDT 2004


Do you want sudo to prompt for a password or are you just strying to
suppress it?

How about modifying your sudoers entry to include NOPASSWD: before the
command(s) being allowed, then sudo won't prompt for a password and ksh
won't have to try to force feed it.

Hope this helps.

- Aaron


> I wrote the following ksh script to automatically change the user ID.
>
>
>
> #!/usr/bin/ksh
>
> PASSWD=test1
>
>
>
> sudo -S su - otheruser << EOF
>
>    echo $PASSWD
>
> EOF
>
>
>
> When I run the script the passwd is passed to the su command properly but
> I
> get the following
>
> error message every time I run the program
>
>
>
> Password:
>
> Sorry, try again.
>
> Password:
>
> sudo: 1 incorrect password attempt
>
>
>
> I've checked that I am user "test1_user" and my passwd is test1.
>
>
>
> Does anyone have any clues of why my script is failing?
>
>
>
> TIA
>
>
>
> Steffen
>
> ____________________________________________________________
> sudo-users mailing list <sudo-users at sudo.ws>
> For list information, options, or to unsubscribe, visit:
> http://www.sudo.ws/mailman/listinfo/sudo-users
>




More information about the sudo-users mailing list