jtorres - May 5, 2005 - 1:50 am
Hey guys...
well i have a server running around 100 users on a mac os x server (10.2.8). workgroup manager recently deleted all the names from the list. I called apple and they manage to import the names back in workgroup mgn. The issue that i have now is with the users' permissions on the clients. I checked the server and went to the users folder and checked and saw that 90 percent of the users don't own their accounts,folders and files.
I tried Disk Utily..repair permissions but was unsuccessful. When user log in they get message like "access denied..." when they try to access of save or delete a file. IS THERE A WAY I COULD REPAIR PERMISSIONS FOR ALL MY USERS INSTEAD of GOING ONE BY ONE CLICKING "GET INFO" AND CHANGING THE OWNERSHIP. IT'S VERY TEDIOUS TO DO IT THAT WAY. PLEASE HELP. THANK YOU
I would also like to know if is normal or strange that workgroup manager just delete the names listed under account and if does happen how can i get those names back if i don't have a back up of my users.
ericl - May 5, 2005 - 2:08 pm
Hi Jonathan.
What you want to do requires using the UNIX command line and possibly writing a shell script.
The command that does what you want is chmod.
Eric Lilleness
--------
jtorres - May 6, 2005 - 10:30 am
thank you
jtorres - May 6, 2005 - 2:34 pm
Hey Eric
I'm don't quite know how to write a shell script , but I know hot to use chmod. Would you instruct me how to do one.
I also went online and seach for some help. I found the following information......
Fixing Ownership Issues
OK, so let's say you've got problems with your user home directories. Maybe the ownerships are messed up. Maybe it's the permissions. There's a way to repair either, or both. Here's how...
1. Log into your Mac as root.
2. Launch Terminal and type "/bin/zsh"
This changes the shell you are using - this method doesn't work in the default shell... it uses z shell.
3. Type "cd /Users" to make the Users folder your current working directory.
5. Want to double check? Type "ls -l" and your user directories should go flying up your screen.
6. Type "for i in *;do chown -R $i $i;done"
That's it. Ownership for every directory and sub directory are now set properly.
The ; is basically a line break, so here's a line by line breakdown:
for i in * = for each item (in this case folder) in the current working directory.
do chown -R $i $i = do the change owner (chown) command. The -R means recursive, meaning every subdirectory included. The first $i is what you want the new owner to be. In this case, the $i represents each folder in the directory. The second $i represents the name of the folder you are affecting.
done = this signifies the end of the scipt.
Basically, what you're doing in plain English is saying:
"OK. I'm in a folder named Users. In this folder is a bunch of folders with names. The name of each folder is the short name of the person who is supposed to own it. So computer, I want you to go through each folder here, and look at the name of the folder, and make that name the owner. So if the folder is named jbond, I want the owner to be jbond. And while you're at it, each of the folders will have subfolders, and all the subfolders need to be set the same as their host folder. So all the folders in jbond need to ALSO be owned by jbond."
Whew!
This strategy will work, assuming that the following statements are true:
* You have entered all of your users into the server.
* Each of your users has a short name, and that short name is the same as the name of their directory.
Fixing Permission Issues
You read about chmod above... it's the command that changes permissions. Suppose you wanted to restore all permissions for all user folders and files to the Apple defaults. Here's what you'd do:
1. cd /Users
2. chmod -R 700 *
3. chmod 755 *
4. chmod -R 755 */Public
5. chmod -R 755 */Sites
6. chmod -R 733 */Public/Drop\ Box
7. chmod -R 644 */Sites/images/*
BUT I WAS UNSUCCESSFUL. I DON'T KNOW IF I'M DOING IT WRONG OR DO I NEED A SCRIPT IN ORDER TO DO THIS.
WHEN I TYPE without the quote "for i in *;do chown -R $i $i;done"
in the terminal it says command not found, unrecognize variables..
WHAT SHOULD I DO????????
ericl - May 6, 2005 - 3:33 pm
Hi Johnathod. The stuff with the for i in*
is syntax to fix ownershipwith the chown command.
If you are just fixing permissions, you only want to the the chmod commands near the bottom of the instructions. Your original question was about permissions. Ownership is related, but another command.
So, to recap, if you have a permissions problem, just run the chmod commands interactively.
If you have an ownership issue, then you will probably want to use the chown command with the script.
Let me know which you need to do; fix permissions or fix ownership.
Thanks, Eric
--------
jtorres - May 9, 2005 - 2:17 am
Well it seems that i need to fix the ownership.
That's the root of the problem. Almost everyone don't own their accounts. The problem is that i tried "for i.."
and it gave be an error..."command not found"...unrecognize variable"
so what do i need to do...????
I went directly to the terminal and typed ..
"for i in *;do chown -R $i $i;done"
without the quote and it gave the above error.
ericl - May 9, 2005 - 10:42 am
Hi Johnathon.
The syntax you are being told is kinda like running a shell script in interactive mode on the command line. If you want to use this method, follow the directions except:
just enter for
This will put you in "script" mode; the prompt will change to a >
Then enter the rest of the command line:
i in *;do
Beware that the syntax you have will change user ownership but not group ownership, so either fix the script or bite the bullet & do it manually as follows:
Become root (the root account is not enabled by default)
cd /Users
Do a long listing:
ls -la
Like your directions say, there should be a directory for every user on your system. The directories should be named after each user. The user and group ownership needs to be the same as the name of the directory.
So, for a directory named johnathon, ownership needs to be johnathon johnathon. To do this manually on the command line say:
#chown -R johnathon:johnathon jothathon
repeat for every directory under /Users
Eric Lilleness
--------
jtorres - May 9, 2005 - 11:17 am
Hey Eric
I'm not very familiar in changing to script mode.
I for our directions.
I typed.......
for but it didn't changed to a>
I'll appreciate if you could help me to do it this way because i have do many accounts. I could do it manually but it will take me forever.
Thank you for ou help.
Jonathan
ericl - May 9, 2005 - 5:48 pm
type the following into the standard shell.
you will need to become the root user
you will need to be in the /Users directory:
root# for i in *
> do
> chown -R $i:$i $i
> done
The stuff you found on the Internet did not work for me either.
Eric
--------
jtorres - May 10, 2005 - 1:42 am
Thanx. It worked. I going to change to permssion too.
jtorres - May 12, 2005 - 2:07 pm
Thank for your help. I appreciated.