[SunHELP] help on script writing

Jan Johansson sunhelp at sunhelp.org
Wed Dec 5 04:22:32 CST 2001


On Wed, Dec 05, 2001 at 03:27:56PM +0800, MUHAMED, Mohd. Khairul
wrote:
>If I want to su to another user in a script, how do I write it
>in a shell script?
>
>The 'su - otheruser' is easy but how do I write/supply the
>password to the password prompt.

For this kind of thing I would suggest sudo [1].

Otherwise 'su - user -c command' might work.

[1] http://www.courtesan.com/sudo/



More information about the SunHELP mailing list