As above. I have scoured the web, i also rang mac support and annoyed a mac (OSX Lion) genius (out of desperation). I have no idea how to do this, I really don't want to have to sit on top of a terminal and give it commands. Has any one encountered this or got a solution?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
You probably need to SETUID the application to root.
Now whenever someone in the wheel group runs myJavaApp, it will run as its owner (root). Just make sure you're in the wheel group (or whatever other group)
Alternatively, you could chmod a+s myJavaApp ... but that would let ANYONE AT ALL run the program as root. I would think carefully about that.
Try looking at Greg Guerin's AuthKit library. It is a Mac-specific library that wraps Mac OS X Authorization Services.
Here is an example:
The
auth.authorize()
call will cause the standard "Please enter your password to allow program X to make changes" dialog. The user can cancel if desired, causingglguerin.authkit.UnauthorizedCancellation
to be thrown.This solution has a huge advantage over using
sudo
orsetuid
: it only runs the necessary tasks as root.One last gotcha: the default JNI loader for AuthKit uses the Cocoa/Java bridge, which was removed from Mac OS X as of Snow Leopard. So on recent versions of Mac OS X, the code above will fail with
UnsatisfiedLinkError
. To work around this, use the following:Finally, be sure to read the AuthKit documentation for more detail.
If you run the application as the root user, the application will have full access to everything.
This is a dangerous operation however because it gives the application full privileges.
Another option would be to run it as a user that has the needed permissions to the files in question. This can be done by putting the user or the files in the appropriate group.