The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


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 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

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 10-02-2001
Registered User
 

Join Date: Mar 2001
Location: Washington, DC
Posts: 7
Question su and password in a Korn shell script

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  
Old 10-02-2001
Registered User
 

Join Date: Sep 2001
Location: Green Bay, WI
Posts: 66
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  
Old 10-03-2001
Registered User
 

Join Date: Dec 2000
Location: Greater Dallas area
Posts: 405
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
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:48 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0