The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-02-2001
Melissa Melissa is offline
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...
  #2 (permalink)  
Old 10-02-2001
edog edog is offline
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 (permalink)  
Old 10-03-2001
98_1LE 98_1LE is offline Forum Advisor  
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:51 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0