Link to home
Start Free TrialLog in
Avatar of sn8776
sn8776

asked on

su - pass in userid and password

How to pass in user id and password when executing 'su' command in a script?
Avatar of jonke
jonke

Would it not be easier to run the script as root, then at the start su to a different user- that way you wouldn't need a password.
Then you would just have to 'exit' back to root, to do something as root.
ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ahoffman - Couldn't you use su - user < file_containing_password or is su too smart to be cheated that way?
Avatar of ozo
su is too smart to be cheated that way
But on some systems you may be able to
chown user script
chmod u+s script
Avatar of sn8776

ASKER

Hi all,

I was told that i can try out using "Sticky Bit", so I think will closed this question by giving the point to ahoffmann as he is the one to proposed the answer to me and I got answer for this question from u all clearly.

I also would much appreciate if any of you can tell me more about the "sticky bit" technics and may be where I can find more information about that.

No extra point for this.

Anyway, thanks for you all to repond to my question.

from
sn