![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| substr() thru awk Korn Shell Script | sbryant | Shell Programming and Scripting | 4 | 01-24-2008 08:16 AM |
| Help with Korn Shell script | heprox | AIX | 1 | 12-19-2005 11:04 AM |
| korn shell script | pavan_test | UNIX Desktop for Dummies Questions & Answers | 3 | 10-27-2005 09:09 AM |
| korn shell script | pavan_test | UNIX for Dummies Questions & Answers | 1 | 10-26-2005 10:17 AM |
| Multiple su - in Korn Shell script | furrari | Shell Programming and Scripting | 2 | 07-30-2004 06:29 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi All,
In my shell script I want to use su - userid and provide password for this user, but I don't know the syntax to do this, can anyone tell me what it is? I have tried: su - userid/password and su - userid password but no luck... |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
as far as I know you can not su in a script.
the only way to do this is to use expect to automate the su or the perl telnet module to telnet in as a different user within the script , or use sudo to run a script as another user. Hope this helps Ed |
|
#3
|
|||
|
|||
|
If the script is running as root I believe you can use 'su -c username' to change the owner of the process. The problem with using su and entering the password before completing a script is that a new shell is spawned for the new user, and the commands in the script after the su will not run until that shell is exited.
__________________
[url=http://chuckb.1le.net/]My website[/url] |
|||
| Google The UNIX and Linux Forums |