Shell script sudo without password prompt under Darwin?
Other *NIXThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.