Thread-topic: Changing permissions on system files
Thanks for the details, I'll try it on Monday and see how far I get.
As to why I am doing this...
We have a situation where when some of our customers try to run our Java
app, it crashes before it gets very far. Investigation reveals that the
crash happens in native code as a result of trying to get a font.
This situation happens because our customers are in the printing
industry and sometimes they decide to remove critical fonts from their
system -- especially Arial, and sometimes Helvetica too. Usually we can
rectify the problem by getting them to put Helvetica back on the system,
but sometimes they are reluctant to do this because it can interfere
with their other apps.
I've written some code during our application start up that checks all
the usual places for fonts to see if Arial and Helvetica have been
removed. If they have, I throw up a dialog asking them if they want to
install Helvetica. I use the Lucida Grande font for the dialog because
I'm told that if Lucida Grande is missing, Mac OS won't run very well
anyway (so the point is moot).
I thought the best place to install Helvetica would be
/System/Library/Frameworks/JavaVM.framework/versions/1.4.2/Home/lib/font
s
so that this would not impact any non Java applications. However, this
directory is owned by root, and there is no write access for the wheel
group or others. I thought I could temporarily chown the fonts directory
to a user with admin rights, install the font file, then chown it back
to root.
Cheers, Eric
-----Original Message-----
From: java-dev-bounces+eric.kolotyluk=email@hidden
[mailto:java-dev-bounces+eric.kolotyluk=email@hidden] On
Behalf Of Greg Guerin
Sent: Friday, January 27, 2006 5:37 PM
To: email@hidden
Subject: 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
m
This email sent to email@hidden
_______________________________________________
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