![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| substr() thru awk Korn Shell Script | sbryant | Shell Programming and Scripting | 4 | 01-24-2008 11:16 AM |
| Help with Korn Shell script | heprox | AIX | 1 | 12-19-2005 02:04 PM |
| korn shell script | pavan_test | UNIX Desktop for Dummies Questions & Answers | 3 | 10-27-2005 12:09 PM |
| korn shell script | pavan_test | UNIX for Dummies Questions & Answers | 1 | 10-26-2005 01:17 PM |
| Multiple su - in Korn Shell script | furrari | Shell Programming and Scripting | 2 | 07-30-2004 09:29 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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... |
|
||||
|
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 |
|
||||
|
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.
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|