10
1
I have a certain binary program on OS X that can only be run as root.
I'm tired of prepending sudo
each time I invoke it and typing the password, and would like it to automatically run as root when I invoke it regularly, without asking for a password.
The program's owner is root and its group is wheel.
I tried chmod ug+s
to set the userid and groupid upon execution to root/wheel, but when I run the program without sudo it still complains that it can only run with sudo or as root.
What did you
chmod
on? The actual program is buried in the package/app. For example, here's where you would find Disk Utility:/Applications/Utilities/Disk Utility.app/Contents/MacOS/Disk Utility
. – jww – 2015-10-02T23:02:21.183Can it be run at a particular time or when some event occurs? – user151019 – 2011-05-31T12:22:55.180
9Old time unix gurus would suggest that invoking a root-only operation by hand on a regular basis means you're doing it wrong. Is this something that can be automated? Or run as a daemon? More detail might bring suggests for solutions of a different kind. – dmckee --- ex-moderator kitten – 2011-05-31T12:41:32.147
Is the program actually owned by root? Setuid/gid will use user/group of the file. – Daniel Beck – 2011-05-31T13:29:15.213
2… where "more detail" also includes such things as whether this program's binary is on a NFS mounted volume and whether you use the
nosuid
mount option … in addition to why you must regularly run a program as the superuser. – JdeBP – 2011-05-31T13:29:41.367@dmckee a lot of mac users run server software on their workstation and it's often setup to require root for things that really shouldn't need it... but reconfiguring a LAMP stack to run without root is a pain in the ass. On the other hand, restarting apache 20 times a day and typing sudo each time is also a pain in the ass. This is a simple solution. – Abhi Beckert – 2012-11-09T01:06:33.677