Changing the Ownership permissions on a file


Ok, here is a quandary I am in … me and 2 of my co-workes are dealing with a permissions issue on the server. We use to deny access to users to be able to open and do any saving to a quark file. They could however, open it and make a pdf or print it…Now, whoever works on the quark files ends up owning it and if anyone even tries to open it to view, print or make a pdf, access is denied. They have to keep coming back to us to make the PDFs…it is getting crazy…
So, I want to be able to quickly select a bunch of quark files and change the permissions in the info area so that anyone would be able to open them back up. The hitch is, since there are 3 of us and all of have some we own, and some the others own, it cannot crash the script if it is one that, say, I couldn’t have permission to change. In other words, I am manually now, selecting a bunch of quark files, getting info, changing the ones I can, and closing the ones I cannot. Does that make sense, and is it possible to work with script events to do this?



Try this droplet:

on open theItems
	repeat with myItem in theItems
		set myPOSIX to POSIX path of (myItem as alias)
		set myName to quoted form of (name of (info for (myItem as alias)))
			do shell script "chmod -R 755 " & quoted form of myPOSIX
			display dialog "Updated permissions on " & myName
		on error theErr
			display dialog "File not editable " & myName
		end try
	end repeat
end open

Save it as an an app and drop the files on it. It should give the user read/write access and everyone else read only access. If you can’t change the permissions it will let you know.

Best wishes

John M

Hi John.
This looks great…I tried it on my home machine and so far so good…
I will not be back at my NY office until Wednesday, where I will be able to try in on the server files.
I will write back after Wednesday and let you know if it worked.
But from what it is doing on my home machine … it looks very very promising…
i was trying some stuff today, and i was trying to play with that POSIX path, as I looked up some things that told me this would be necessary…but I wasn’t even close, and the whole shell script thing…oy…so thank you…

Hi John,
Thank you so much for your patience, I finally got access to try this at my computer in the office.
Everything is fine, except for one thing.
If I knew how to upload a snapshot it would be easier to show you, but I will do my best to explain.

In the info area:

The First Access is Read & Write (which allows my to change the other settings)

Right now under Group the Access: is Read only and that too needs to be Read & Write only the last one, Others needs to change to Read Only.
That is my fault, I thought I would be OK with both of those on Read Only, but that other Access also needs to be Read & Write.

I tried to look this up and figure it out myself, but I have not been successful…if I could get the second Access to be Read & Write, that would be great.

Also, I have only tried to drag multiple files on the droplet, Can I also drag a folder of Files…Obviously, only the ones I have permission to change would change, and my co-worker would only be able to change they ones she can, but that would be important, as the documents could be mixed in a folder.

Thank you so much!!!

Hi Babs,

Change the chmod line where it says 755 to 775.

Best wishes

John M

Hi John,
I actually did that…Is was the first thing I tried…I was playing with a a few, but that made the most sense…but it seemed random, so I thought it was wrong…Then I found 664…Showed promise till it locked me out of my folder…Good thing I am only testing…
Let me go back to the 775…will keep you posted!!!

Hi John,
It seems to be working just fine, even with a folder dropped on it :wink:
Thanks so much!!
For once I got something right and I still blew it :wink:
Thankfully you wonderful people are out there!!!
Much Appreciated!
babs :lol: :smiley:

I’m glad it’s finally working for you. :wink:

John M

Just an FYI:

The reason dropping a folder worked is the “-R” parameter. That is the “Recursive” setting that causes the shell script to recurse through any subfolders in what you dropped on the script.

Hi Guys!
Thanks again John!!!
…and Matt-Boy, thanks for that as well…when I was trying to look up what those numbers meant, I had moments thinking the -R was maybe something else i needed to change. You know, like add another one to access the other drop down…Trying my best here to figure this stuff out…
So, that makes sense, as I didn’t always see that online in examples. So thanks for clarifying that.

You guys are great!
babs :smiley: