|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
||||
|
||||
|
Root Privileges
Good Evening,
I am trying to write some shell scripts to start, restart and stop my Apache web server. I plan on activating these scripts remotely. The Apache start up command requires Root Privileges. When I have run the command on the webserver it self I have always used 'sudo'. Does anyone know how to give my shell script Root Privileges so that I don't have to type the password. I want to be able to issue a command to my webserver by email remotely that will run the shell script. So the script has to run all by itself without having me typing in the password. -any thoughts or ideas, appreciated.
__________________
---| The Universe| |
|
#2
|
||||
|
||||
|
You can use visudo to edit sudo properties. Here's a quick guide
I recommend you run it as it's own user however (useradd -m myscript ; passwd myscript) so that not just anyone can use it. Another option is to make a binary that's setuid root to run your script (scripts can't be setuid root in tiger onwards for security reasons). But it would have to run your specific script or that could be abused, and frankly it's too much effort. What I would do is create a new user, turn off bash logging and use -i with sudo. sudo myscript | echo password The above should be called when you use it, anyone could just read the password out of the file otherwise. And naturally, being lazy, while I recommend the third option, I used the first since my server is remote and can only be logged into by PKA.
__________________
~James [Not currently seeking freelance work] Like philosophy or interested in spirituality? Philosophorum. Game Dev Experts Forums Foresight Linux - Because your desktop should be cool! Linux FAQ FedoraFAQ UbuntuGuide |
|
#3
|
||||
|
||||
|
Thanks again mate.
I think I'll be going with your first option. I should have clarified in my first post, I am not really remotely controlling my computer. I am using Apples mail program to execute commands to my computer. In apples Mail program you can assign rules to email accounts. So I can have mail wait for an email from me issuing a specific command, when it receives the command Mail will run an applescript. The applescript will then run my shell script. No one operates this machine but me so turning off authentication isn't a big deal. |
|
#4
|
||||
|
||||
|
Beware with that, someone could fake your email address hypothetically.
|
|
#5
|
||||
|
||||
|
Good point my friend.
Mailbombing is probably the easiest trick in the book. They would still need to know my commands though. I might set it up so that before the script activates, I am sent an email back for confirmation. Just for security. Thanks Mate. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > Mac Help > Root Privileges |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|