new user permissions


Well, OSX is finally giving me troubles. My cd disk burning doesn’t work and getting all kinds of errors when checking disk. So, I created a new user and transfered all files from my original user to the drop box of the new user. Then, I deleted the original user. Now, the owners of all applications I installed are blank.

I created an AppleScript to change the owner of just a chosen application to the new user.

set f to choose file

tell application “Finder”
set the_owner to owner of f
end tell

SetSubOwners(f, the_owner)

on SetSubOwners(the_folder, the_owner)
tell application “Finder”
set item_list to (every item of the_folder)
repeat with this_item in item_list
set owner of this_item to (the_owner as Unicode text)
if kind of this_item is “Folder” then
SetSubOwners(this_item, the_owner)
end if
on error err_mess
exit repeat
end try
end repeat
end tell
return err_mess
end SetSubOwners

before I used the error handler, it errored somewhere and the original script with the error wasn’texactly like this script. It errored somewhere within the repeat loop. I’m thinking that it’s erroring because the owner of the app (and all sub items) is blank. I’m thinking that this is a job for unix. Mainly, all apps that I installed as the other user has an owner that is blank. Also, the permission for group is read only while I think it should be read/write with admin for group.

What’s the best way to change this stuff?

Hoping I’ll get some money to fix my cd read/write and install Tiger if I ever get some extra money.

PS, How do you create a new admin user with all the same permissions as the old user.


From Mac the Missing Manual:
To change ownership of an item, use “chown” (for change owner) command followed by its two arguments: the new owner’s account name and the pathname of the directory you want to reassign.
In a folder called “Pix” owned by “T” change the owner to by

“sudo” is short for “superuser do” and allows you to execute any command as though you logged in the root account :o without needing to know the password for the root account.

There is a ton of info in here on this if you need more, group ownership, root ownership (dangerous to do), etc. Post back with updates.

Hi sitcom,

The application I tested the following on doesn’t have an owner, so I left it out not knowing what to do.

set f to choose file
set p to POSIX path of f
set q to quoted form of p
set c to "sudo chown -R kelh " & q
do shell script c

What do I do if the owner is blank? I ran the above script choosing Netscape as a test file and I get the sudo warning about typing.


This is going past my knowledge…There is no mention of a blank owner! There was an interesting suggestion of trying a (shareware) program called SuperGetInfo.

I downloaded and installed it, it has a 14 day fully working demo; I targeted Netscape and a nice interface comes up allowing you to set owners & permissions. I wonder what it would read as “owner” in your case. You set the owner from a list and then click to set all sub-directories. Good luck!


Hi sitcom,

SuperGetInfo worked well on the one app I needed to update. It needs a batch type ownership setting instead of just the enclosed items.

I might try ui scripting the Finder info window.

Thanks a lot,

kel, knowing you (or at least your posts), I have no doubt that you will figure out how to do this with UI scripting, but shell scripting is a really powerful tool for these sorts of sysadmin tasks.

Check it out…

chown is the utility for setting the owner and group for files and chmod is for setting permissions. You can get info on these commands from

You need to provide a couple parameters to chown. The -R stands for “Recursive” so all elements of the thing you’re trying to change get updated. Same as clicking the “apply to enclosed items” button in the get info screen. The user and group are supplied like user:group and the path is posix quoted like you have.

So here’s the thing. Since you don’t own the file, (nobody does), you need to run the command inside a sudo. Try something like “sudo ls” in terminal. You’ll see that it requires a password. If you are an administrative user on the computer, your password will work. You don’t need a root password or anything fancy. (I’m using ls because it doesn’t change anything on your computer, so it’s safe to use when you’re playing around with sudo.)

Once you see how that works, try doing a sudo chown in terminal just so you can see you have the syntax right before putting it into a script. (I alway test my commands in terminal before adding them to an applescript!)

You’ll need one more trick. In terminal, sudo prompts for a password from tty (the terminal session input). In a do shell script, there is no tty, so you need to get the password in some other way. You can hard-code your password into your script, or better yet, prompt the user for it at runtime. Then you pass that in through stdin by adding the -S parameter to sudo.

echo password|sudo -S ls

echo just sends the password into stdin, the “|” char passes it on to the next command, which is sudo with a -S parameter, so it works.

So your command set line will end up like this…

set c to "echo password|sudo -S chown -R kelh " & q

Try it, you’ll like it!

Hi digest4d,

It’s a good thing I remembered that I had posted this. Your tutorial is perfect and I now know what -R means on top of that! :slight_smile:

I don’t know why, but I have a very hard time understanding most man pages. More experience would probably do it.

Now to write the script for the whole Applications folder. I know I have to be careful with sudo.

Thanks a lot!

Believe me, man pages didn’t make any sense to me when I started, either. Then again, neither did most apple script dictionaries! It takes time, but you’ll get the hang of it. The script for the whole apps dir shouldn’t be hard if all the apps will have the same owner and group. Just hit the dir with a chown. The -R will make sure that all the contents get updated.