![]() |
|
|
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 |
| Logging into oracle or SQL from shell script | manirsendhil | Shell Programming and Scripting | 2 | 04-10-2007 12:46 AM |
| Logging OWB mapping execution in Shell script | npn | Shell Programming and Scripting | 1 | 11-16-2006 09:25 AM |
| Have a script running even with the shell logging out | 435 Gavea | Shell Programming and Scripting | 4 | 09-20-2005 05:20 PM |
| logging in Shell script | laila63 | Shell Programming and Scripting | 3 | 07-16-2004 06:50 PM |
| shell script error logging | niamh | UNIX for Dummies Questions & Answers | 1 | 04-05-2004 12:17 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
logging as su from script
Hi,
I am running a script where i need to run another command in a particular folder which I do not have access so I need to login as su to that folder and run that script...what are the options I need so that I can skip interactive mode ..here is what I tried.. #! /usr/bin/sh ./profile su - u02 password # it does not take it this way... cd /u02/inf pmcmd -u $username -p $password -s $server..... .... here my problems are after executing the .profile it ececutes su and waits for password........ 1) how should I enter the option su as i run the script from my ID specifying su password... 2) will the variables that are defined in my profile stay even though i do su and run command because $username,$password,$server are in .profile..... how should I use it...please help... |
|
|||||
|
Quote:
http://www.uwsg.iu.edu/UAU/advcomm/sudo.html 2) As per the manual entry for su, if you want to retain the previous environment variables, your command will be Code:
su username and if you want to use the environment for the user you are changing to Code:
su - username |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|