Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing permissions on system files



Eric Kolotyluk wrote:

>The problem is when I try something like
>        chown user directory
>
>I get back
>        Chown: directory: Operation not permitted
>
>The current owner of directory is root. I can't think of any way to make
>this work without enabling the root account and doing an "su"

1) Ask the user for the admin password, then use 'sudo -S'.  See 'man
sudo'.  For this to work, the user must already be logged in under an admin
account.

2) Use my open source AuthKit, which is a Java API to Mac OS X's
system-level authentication dialog:
  <http://www.amug.org/~glguerin/sw/#authkit>

AuthKit does NOT need to be logged in under an admin account.  The user
still has to know an admin-account user-name and password, though.

AuthKit uses JNI code, which I have not yet compiled as Universal Binary.
However, I include all source, so you can do it yourself if you need it.
And last time I checked, it did work on J2SE 5.0.


>From the GUI I can select a folder or file and bring up the Get Info panel
>and I can change the owner from system to my login ID, but is there any
>way to do this programmatically?

That's not just "the GUI": it's the Finder.  So a 3rd possibility is to
exec() an 'osascript' command that tells the Finder to present a Get Info
on something and then activate (come to front).  If you're only changing
permissions rarely, that may be a workable strategy, because it delegates
all the authentication to the Finder.  See 'man osascript', and for the
scripting verbs, open the Finder's dictionary in Script Editor.


I can't help asking:
  What system files do you want to change the permission or ownership of?

  -- GG


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.