Mac Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsMac Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old April 29th, 2007, 05:18 AM
benno32's Avatar
benno32 benno32 is offline
/*
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2007
Posts: 431 benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 19 h 24 sec
Reputation Power: 349
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|

Reply With Quote
  #2  
Old May 2nd, 2007, 02:00 AM
LinuxPenguin's Avatar
LinuxPenguin LinuxPenguin is offline
fork while true;
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: May 2005
Location: England, UK
Posts: 5,535 LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)  Folding Points: 11590 Folding Title: Novice Folder
Time spent in forums: 1 Month 3 Weeks 1 Day 19 h 23 m 58 sec
Reputation Power: 1008
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.

Reply With Quote
  #3  
Old May 2nd, 2007, 05:47 AM
benno32's Avatar
benno32 benno32 is offline
/*
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2007
Posts: 431 benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 19 h 24 sec
Reputation Power: 349
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.

Reply With Quote
  #4  
Old May 2nd, 2007, 01:47 PM
LinuxPenguin's Avatar
LinuxPenguin LinuxPenguin is offline
fork while true;
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: May 2005
Location: England, UK
Posts: 5,535 LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)  Folding Points: 11590 Folding Title: Novice Folder
Time spent in forums: 1 Month 3 Weeks 1 Day 19 h 23 m 58 sec
Reputation Power: 1008
Beware with that, someone could fake your email address hypothetically.

Reply With Quote
  #5  
Old May 2nd, 2007, 06:20 PM
benno32's Avatar
benno32 benno32 is offline
/*
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2007
Posts: 431 benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level)benno32 User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 19 h 24 sec
Reputation Power: 349
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsMac Help > Root Privileges


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway