Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to call a different userid from inside a script

Status
Not open for further replies.

desibhai

Programmer
Sep 25, 2002
5
AU
I want to call another user login from inside a script
and then want to execute few commands. After execution,
I want to return back into my script.

How can it be done.
 
Hi:

Use the su command:

su - user -c "cd /tmp; pwd; read x"

If you're not root, you're prompted for the user's password. man su for more info.

Regards,


Ed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top