Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Resetting permissions on multiple user folders' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Resetting permissions on multiple user folders
Authored by: kal on Apr 14, '03 12:57:59PM
Just a small refinement... How about changing:
chmod -R 700 $full
with something like
find $full -type d -exec chmod 700 {} \;
find $full -type f -exec chmod 600 {} \;
This way, all the regular files (-type f) of a user will only have read/write permission, but the catalogues (-type d) are still accessible. All of the user's executables will have the wrong permissions, but usually there are fewer executables than regular files... Just a sub-tip...

[ Reply to This | # ]
Resetting permissions on multiple user folders
Authored by: Mizou on Apr 14, '03 06:07:04PM

Another suggestion is to change 'cd /Users' to 'cd ~/..' to make the
script independant of the location of the Users catalog.

I for instance have the system and the Users catalogs on separate
volumes. That way I don't have to backup everything in case I have to
reformat the system volume, and reinstall the system.

If I were to write 'cd /Users' then i'd refer to my unused /Users catalog
on the system volume, while cd ~/.. refers to the catalog one level up
from the currently logged in user, which in my case is the admin
account.



[ Reply to This | # ]
Resetting permissions on multiple user folders
Authored by: alexiskai on Apr 14, '03 08:58:29PM

The way I actually have it set up (I wrote and submitted this hint) is cd /Volumes/Storage/Users because, as you said, my Users folder is in a different location.

The only problem with changing it to cd ~/.. is that the user I usually execute these things from actually has its home folder in /Users, ironically. And if one were to execute it from root for whatever reason it wouldn't work at all. So perhaps better to simply hard-code the location of the Users folder you intend to manage.

I wrote the script mostly because I've had to reinstall the server OS a couple of times while leaving the Users folder alone since it's on a separate partition, and it's handy for making sure OS X understands that user john_doe on the new system should own the folder created by john_doe on the old system.



[ Reply to This | # ]
Resetting permissions on multiple user folders
Authored by: nicola on Apr 15, '03 05:09:43AM
You have already used nireport, so why not use niutil for getting a user's home directory? You may do something like

HomeDirLocation=`niutil -read . /users/$UserName | grep "home: " | sed 's/home\:\ //g'`

note: the above line is for the local domain; I don't have a server at hand, so I can't tell if "home: " (and the following "home\:\ ") will work for network domains too... (maybe not)

[ Reply to This | # ]
Resetting permissions on multiple user folders
Authored by: mithras on Apr 15, '03 08:23:37AM
What you want is:
HomeDir=`niutil -readprop / /users/$UserName home`

---
--
my free OS X applications and scripts

[ Reply to This | # ]

Resetting permissions on multiple user folders
Authored by: nicola on Apr 15, '03 10:20:57AM

Hey thanks!
Guess I should always read ALL the man page...

And: does anyone know if the "home" property is ok for OSX server too?



[ Reply to This | # ]