curtisb has asked for the wisdom of the Perl Monks concerning the following question:
Ok, I have a question. I want to execute a script, which is currently in shell scripting (sh), that does an su to root. Where you have to enter the password. Then I want to execute the commands as root then exit back to user level.
What I have written is this:
#!/bin/sh echo "Enter password when prompted"; su - cd /www/apache/bin ./apachectl start exit
Now I know that there is a better way to do this through perl. Does anyone have any clues on where I should start looking. My biggest problem is switching from one user to root, excuteing the commands, and then exiting.
Please Help!
Thanks,
curtisb
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Executing Root Commands from user level
by arhuman (Vicar) on Jan 18, 2002 at 20:30 UTC | |
Re: Executing Root Commands from user level
by Masem (Monsignor) on Jan 18, 2002 at 20:31 UTC | |
by arhuman (Vicar) on Jan 18, 2002 at 20:36 UTC | |
by Masem (Monsignor) on Jan 18, 2002 at 20:50 UTC | |
by arhuman (Vicar) on Jan 18, 2002 at 21:10 UTC | |
by FoxtrotUniform (Prior) on Jan 18, 2002 at 21:17 UTC | |
by Masem (Monsignor) on Jan 18, 2002 at 21:31 UTC |
Back to
Seekers of Perl Wisdom