LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Other *NIX
User Name
Password
Other *NIX This forum is for the discussion of any UNIX platform that does not have its own forum. Examples would include HP-UX, IRIX, Darwin, Tru64 and OS X.

Notices


Reply
  Search this Thread
Old 02-04-2008, 02:56 PM   #1
lhouk
LQ Newbie
 
Registered: Apr 2004
Location: Houston, Texas USA
Distribution: Fedora 8 (mostly)
Posts: 15

Rep: Reputation: 0
Shell script sudo without password prompt under Darwin?


I have two systems, one running Fedora 8 and the other running Darwin 8.11.1. On both systems, I have edited /etc/sudoers to allow me to run sudo with no password from my user account. On both systems, I run a shell script that runs sudo, and I need the script to run unattended, which means that the sudo can not prompt for a password when the script runs. On the Fedora system, I accomplished this by commenting out the line "Defaults requiretty" in /etc/sudoers. However, on the Darwin system, /etc/sudoers has no such line to comment out, and the man page for sudoers says that the requiretty flag is off by default. Yet, when I run my shell script on the Darwin system, sudo still prompts for a password.

So, can anyone tell me what to do to allow a shell script sudo to run without a password prompt under Darwin? Thank you in advance to all who respond.
 
Old 02-05-2008, 08:00 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by lhouk View Post
On the Fedora system, I accomplished this by commenting out the line "Defaults requiretty" in /etc/sudoers.
Isn't the default to add the "NOPASSWD" arg in the clause allowing users to run apps?
 
Old 02-05-2008, 09:00 AM   #3
lhouk
LQ Newbie
 
Registered: Apr 2004
Location: Houston, Texas USA
Distribution: Fedora 8 (mostly)
Posts: 15

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by unSpawn View Post
Isn't the default to add the "NOPASSWD" arg in the clause allowing users to run apps?
In the /etc/sudoers file on both the Fedora and Darwin systems, I added the line

Code:
%wheel  ALL=(ALL)       NOPASSWD: ALL
which allows me to sudo without being asked for a password, since my account is in the wheel group. However, I need to do something more to get the same result when the sudo is in a shell script. Commenting out the line

Code:
Defaults    requiretty
in /etc/sudoers on the Fedora system worked -- the shell script runs the sudo and doesn't ask for a password -- but I can't figure out what to do on the Mac OS X/Darwin system. Any suggestions would be greatly appreciated.
 
Old 02-08-2008, 11:16 AM   #4
lhouk
LQ Newbie
 
Registered: Apr 2004
Location: Houston, Texas USA
Distribution: Fedora 8 (mostly)
Posts: 15

Original Poster
Rep: Reputation: 0
One more bit of information, for what it's worth.

On Fedora systems, the wheel group is group number 20. On Darwin systems, it's group number 0. Maybe group number 0 is special? Still, when I changed everything in the Darwin systems to group number 20, admins, I was still prompted for a password, so something else is still going on.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sudo without password prompt? ctroyp Linux - Newbie 7 09-12-2007 03:55 PM
ubuntu - running sudo shell script from php mitilma Linux - Security 3 06-14-2007 01:52 AM
How to tell shell script a password? Etoile Linux - Newbie 5 04-05-2006 09:16 PM
Running a script as root with sudo without entering the user password kloss Linux - General 8 10-10-2005 11:39 AM
allow sudo for www user to run root shell script cccc *BSD 12 07-23-2005 03:48 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Other *NIX

All times are GMT -5. The time now is 04:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration