How to Fix the Unknown Group (Permissions)

BACKGROUND

Leopard sets up accounts and permissions differently than Tiger did. In Leopard, users belong to the staff group, while in Tiger they each belonged to their own one-member group named with their short name. Leopard's installation script doesn't migrate the accounts, it just leaves them intact. For example, in Tiger, my XYZ account belong to the XYZ group. Leopard didn't correct that to the staff group (20) or define the XYZ group, so my files belonged to an unknown group. That causes problems with Spotlight and a lot of other stuff.

SOLUTION

The solution requires a separate admin account and enough disk space to make a copy of the home folder.

Prepare for this by unregistering your computer from dot Mac and logging out of it. Also, turn off the Time Machine.

1. Create folders in /Users/Shared that correspond to the folders in the home folder (Desktop, Documents, Library, and so forth)

2. Move the contents of each folder in the home folder to the corresponding folder in /Users/Shared. (For example, contents of Documents to Documents). You cannot just move the folders, because you won't be able to open them from another account.

3. Log off, then log into the separate admin account. Delete the troublesome account, and select the option to delete the Home folder. This is necessary because the troublesome account is irredeemable, and it's the only way you can reuse the short name.

4. Create a new account with the same name, short name, and password as the now-deleted troublesome account and log into it.

5. Open two Finder windows, Sharing and the current account's home folder. Move the files to the current account, but don't overwrite the top-level folders (Desktop, Documents, and so on), move their contents. If you cannot overwrite a folder, open it, and move the contents.

6. When you are working on the /Users/Shared/Library folder, move the Mail folder to the desktop so you can import the mail boxes into your new setup.

7. If you have more than one Mac and you have dot Mac, register the computer and sync now.

8. Import the mailboxes from the Mail folder on your desktop.

Now your user account is ready to use, almost indistinguishable from the old one, except all the permissions are correct and everything works well. There may be a few preferences here and there that you might have to reset.

9. I recommend using Disk Utility to erase the Time Machine disk so you can start over.

This isn't easy, but it less painful than erase-and-install followed by installing all your applications.

24" iMac and 15" MacBook Pro, Mac OS X (10.4.10)

Posted on Nov 18, 2007 6:11 PM

Reply
56 replies

Nov 20, 2007 5:19 AM in response to BDAqua

There is a difference between the group named unknown (99) and a group that is unknown (say, 501).

In an update from Tiger to Leopard, Leopard doesn't change the GIDs in legacy accounts. The accounts and files do not get a GID of 99, they retain the GIDs they had in Tiger, but in Leopard, those GIDs aren't valid. The files have a GID of 501, say, but there is no group with a GID of 501.

The files don't belong to the Unknown group (99), they belong to groups that are unknown (501, 502, and so forth).

Nov 20, 2007 8:21 AM in response to Ken Collins

Actually, the best solution might be for anyone with this problem to file a bug report with Apple and wait for them to fix it. I'm tempted to try your solution, however, I'm not convinced yet that the problem is not Leopard's assigning GID 20 (staff), as I have not yet seen the reason for GID 20 (or maybe I just missed the posts discussing the reason). Who knows, maybe Apple's solution will be to change GID 20 back to the Tiger way of having GID = UID.

I think for nongeeks, the best solution is to put the contents in the Shared directory, delete the legacy account, create a new one, and move or copy the files. The new account can have the same name and short name as the deleted one. All the files get the right permissions. If the old account was 501:501, the new account is 501:20, because 501 was unused when you created it.

Nov 22, 2007 5:07 AM in response to Ken Collins

Hello Ken,

After I upgrade to Leopard, I found my finder's help is broken. So I reinstalled again from Lepoard DVD(upgrade).

Now I can't even import photos to iPhoto.

I found my user id is 501, but group id is 502. And when I create some document, it shows its group name is "wheel".

I want to try your solution, to move everything in my user folder to /Users/Shared then create a new account. But I don't have enough disk space. Is it okay to use external hard drive to do so?

thanks and best regards,

Nov 22, 2007 9:33 AM in response to Ken Collins

Ken Collins wrote:
Let's suppose you want to fix this manually. You cannot change a file's group in Get Info, because if the group is unknown, Finder crashes.


How do you even attempt to change the group access privileges in Leopard's Finder? There is no popup list of groups in the "Get Info" window that I can see (like there was in Tiger's Finder), just the new provision to delete or add more privileges beyond the three standard ones (owner, group, & others) with the "+" & "-" buttons below the list.

Curiously, the "-" button can appear to allow you to delete (for instance) the group privileges but I don't think it actually is doing that.

So could you explain exactly what steps you take that crashes the Finder?

Nov 22, 2007 9:34 AM in response to Ken Collins

In case some of you aint MacFixIt Members: Here's what the thread says:

How to change the group id of files and folders


The problem Since upgrading to Leopard, many users have been experiencing permissions problems. Some of these are connected with Group access to their files. A typical symptom is this: you select a file in the Finder and choose File > Get Info to examine its permissions. Permissions are listed at the bottom of the Get Info window, under "Sharing and Permissions". The Group here is listed as "Unknown". And then, possibly, when you click the lock (to authorize) and then try to change the Group setting, the Finder crashes.

Files and folder with the "Unknown" group are causing other problems as well. There is some evidence that Spotlight might not index them correctly, and perhaps Time Machine may not even back them up properly. And these incorrect groups might be at least partly to blame for the slowness of Repair Permissions on some people's machines. It isn't entirely clear what all the ramifications are.

Nor is it obvious why having an "Unknown" group should make much difference. Groups is Unix are not usually a big deal. The usual way in which groups come into place is when you're the admin user; this fact is expressed by your being a member of the admin group, and it is that that gives you write access to the top-level Applications folder, whose owner is root (which is not you) but whose group is admin (of which you're a member, and so the read-write group permissions on the Applications folder apply to you).

Funny things happen with groups all the time, and you never even notice. For example, in Tiger, when I save a new TextEdit file to my Desktop, it has gid 501, which is correct, but when I create a file with Preview (by copying a selection from an existing Preview window and choosing File > New From Clipboard) and save it to my Desktop, it has gid 0, which is wrong. So Mac OS X itself assigns things the wrong group quite frequently. This has no ill effects, though.

But it seems that an incorrect group such as this "Unknown" group which people are seeing does make a difference in Leopard. Why would this be? Quite honestly, that isn't clear. Perhaps it has something to do with the new implementation of the file sharing system, which depends very heavily on groups. For example, on my Leopard machine, my user is a member of the com.apple.access_screensharing group, because I've got screen sharing turned on for that user, and of the com.apple.access_ssh group, because I've got remote login turned on for that user. That's a completely new mechanism for marking who gets what kind of shared access to the computer, so perhaps that's why Leopard is so touchy about groups, in a way that Mac OS X never was before.

The cause Where are these "Unknown" group settings coming from? In a sense, the answer is very clear: it's that between Tiger and Leopard, Apple has changed its group policy for users.

In Tiger, a user was associated primarily with a group with the same name and number as the user. To see this, in Tiger, give the id command in the Terminal. What you'll see will start something like this:

uid=501(cooluser) gid=501(cooluser) groups=501(cooluser)
In Leopard, a user is associated primarily with the "staff" group. To see this, in Leopard, give the id command in the Terminal. What you'll see will start something like this:

uid=501(cooluser) gid=20(staff) groups=20(staff)
("uid" means user id; "gid" means group id. The id has both a number and a name.)

And there is one other point, which is equally important:

In Leopard, for some people at least, there is no 501 group (or whatever your old group number might be).
It's the combination of these two things - the 501 user used to be a member of the 501 group, but in Leopard there is no 501 group - that is causing a file or folder with group id 501 to have its group described as "Unknown".

Another part of the cause is that, for some people at least, the Leopard installation process is not compensating for this change. It should be. Changing group values is not all that uncommon; it happens all the time. It happens, for instance, when a file or folder is copied from one user to another. For example, when I use File Sharing to connect my Tiger machine to my Leopard machine and copy a file from the one to the other, the file has uid 501 and gid 501 on Tiger, but when it is copied to Leopard it takes on uid 501 and gid 20. In other words, the system compensates for the fact that group 501 doesn't exist on the Leopard machine; the target user on the Leopard machine has group 20, so the copied file is assigned group 20.

The trouble is that this is not happening for some users during the upgrade process, and so there are a lot of files and folders hanging around whose group id is 501. Since there is no Leopard group whose gid is 501, Leopard calls this group "unknown".

Fixing the group id, the Finder way Some readers have found that they can correct permissions on a migrated folder merely by copying it (not moving it) to the Deskop, and then moving it back into place, replacing the troublesome copy of the folder.

Perhaps that technique would have come in handy during the upgrade to Leopard. For example, let's say you did an Archive and Install where your old stuff has ended up the Previous Systems folder. When you move a folder of your old stuff back into place, it might make a difference whether you move it or copy it (by holding down the Option key). Using the latter technique might cause group ids to be changed properly. That point is tentative, though, and probably needs further investigation.

Fixing the group id, the Unix way. Using a simple Unix command in the Terminal, you can correct the group id of all the files and folders within your Home directory, changing only those group ids that are specifically incorrect. (We're going to stay inside the Home directory because messing with permissions outside it is a completely different kettle of fish, and is not recommended unless you really know what you're doing.) If you want to try this, you should be aware that things could backfire very seriously, so make sure you've got a backup before doing anything else, and make sure you mentally sign the MacFixIt Total Indemnification Form in advance. (Having said that, I did run this on my machine before telling you about it, and it did work.)

Use the Spotlight preference pane to exclude your entire hard disk from Spotlight. The reason is that you are about to make a lot of changes, and while you are making them, you don't want Spotlight to be running along behind you, trying to note them all down. This will slow down the whole process considerably. So effectively you want to turn Spotlight off temporarily.

For the same reason, turn off Time Machine temporarily. Oh, by the way, every file whose gid gets changed by this process is going to count as a changed file, so it is going to get copied the next time you perform a Time Machine backup. That could be a long, large backup.

Next, make sure that your group id is 20. The id command in the Terminal, as shown above, should demonstrate this. If your group id is not 20 you're going to need to change it. To do so, use the Accounts system preference pane. Click the lock (to authorize yourself) and then control-click on your user account in the list of accounts and choose Advanced Options. In the resulting dialog, if your Group ID isn't 20, make it so and dismiss with OK.

Now, in Terminal, you need to know the number of the gid that is wrong. So first, find yourself a file or folder whose group is showing up as "unknown" in the Finder's Get Info window, and navigate to its containing folder. In the Terminal, type

ls -aln
followed by a space, and then drag the folder containing the problematic file or folder right from the Finder into the Terminal window, and hit Return in the Terminal. You'll see something like this:

drwx------ [number] 501 501 [number] [date] myFolder
The key thing is that pair of numbers in the middle, which I've shown as 501 501. The first is the uid of this item; the second is the gid of this item. It is the second number, here 501, that should be changed to 20.

Okay, I'm going to pretend that the troublesome group number is in fact 501. Then, in the Terminal, do this. First, type

cd
followed by Return. That's to bring you into your Home folder. Now, very very carefully, triple-checking everything before you dare to hit Return, type

sudo find . -group 501 -exec chgrp 20 {} \;
Because of the pesky CMS used here at MacFixIt, I can't be sure how that is going to come out on your machine, so I'm going to recite it in words: "sudo", space, "find", space, dot, space, hyphen-"group", space, "501", space, hyphen-"exec", space, "chgrp", space, "20", open-curly-brace-close-curly-brace, space, backslash-semicolon. I'm particularly worried about that backslash.

To explain all of that:

"sudo" means "Let me do this even if permissions would normally stop me."

"find" means "Locate the files matching the following description and perform the following operation on them."

dot means "Start in the folder where we are now," which is your Home folder because of the previous cd command.

"-group 501" means "Look for files and folders whose group id is 501." If your troublesome group id is different (e.g. 502), the number here will need to be different.

"-exec" means "And here's what I want you to do when you find one."

"chgrp 20" means "Change its group id to 20".

{} means "When I say 'it', I mean the file or folder you just found."

backslash-semicolon means "That's the end of what I want you to do."

If you're happy with all that, press Return. This command is going to take quite a long time to execute, so don't be discouraged. Don't do anything with the computer, either. Just let it run. There isn't going to be any feedback until it's all over, at which time your prompt will appear in the Terminal (and, if you computer is like mine, your fans will spin back down!).

You can now use ls -al in the Terminal, or use the Finder's Get Info window, to check that things went as expected. When you're satisfied, restart the computer (just for luck), and remove the hard disk from the Spotlight excluded items. Spotlight will reindex the hard drive. When that's all over, you can turn Time Machine back on and resign yourself to a large backup next time it runs.

Conclusions The change between Tiger and Leopard where a user's group number is now 20 instead of a number matching the original user number is a big change, and it seems that Apple didn't prepare for it as well as it might have. And pulling the rug out from under users by invalidating the previously existing 501 group is really not very nice. However, what's most distressing about the current situation is, as usual, the lack of information and the lack of tools.

Apple gave no warning that this change was coming.

Apple has never, since the dawn of Mac OS X, supplied a decent GUI utility for fully dealing with Unix ownership and permissions.

Apple has never provided clear information on what the correct ownership and permissions for various files and folders should be.

There is thus a tendency on Apple's part to obscurity verging on silence when it comes to technical matters, even when those technical matters are quite important. This might be to some extent denial ("Mac OS, it just works") and partly a desire not to burden users with technical concerns. But when you're knee-deep in the frustration of the situation that the Leopard installation has left you with, Apple's attitude may feel more like plain arrogance. In any case, the irony is this: thanks to the lack of decent official GUI tools and information, users are burdened with those technical concerns anyway, and have no recourse but to grapple with the underlying Unix data in the Terminal, and are left to a combination of deduction and guesswork to figure out what the goal is and how to achieve it.

Nov 22, 2007 10:10 AM in response to SteveDjokes

Thanks for posting that.

However, I have to say I disagree almost completely with everything it says, although the ' find with ' chmod' will probably be a reasonable workaround for most people.

First and foremost, if an update went and unilaterally wiped out all of my custom groups and changed the group owner of all of my files, I would be thoroughly ******. That would be a sign of arrogance. Apple shouldn't do this, and they didn't.

This is primarily a "Finder" bug - it does't know what to do with a group lacking a ' RealName'. That's just dumb. It could go on the ' name' or even the ' gid' instead. And even if the group doesn't exist at all, the "Finder" shouldn't crash because of it.

In the past, a file or folder owned by a ' gid' that didn't have a formal group entry in "NetInfo" was labelled as "(Unknown)". Now "Finder" has gotten even stupider and is calling things "(unknown)" even if there is a corresponding group - just because it is missing the previously unneccesary ' RealName' property. Not to mention the mere use of the work "unknown" is easy to confuse with the real group ' gid=99' "unknown".

These are "Finder" issues, and that is something Apple should fix.

Nov 22, 2007 10:19 AM in response to SteveDjokes

You don't have to know what the default permissions are. If you boot from the Leopard install disk, you can run the reset password utility. Specify a disk, a user account on the disk, but don't reset the password. Instead, just that it should fix the permissions. The utility fixes the permissions and ACLs on the user's home folder and everything in it, but it does not fix any incorrect group assignments.

The groups are listed in Get Info, but they aren't labeled as such. If you have a group that is unknown, you can't delete it and if you attempt to change its access rights, Finder crashes. To fix group assignments, you have to use chgrp on the command line.

MacFixit's solution lets you change the group assignments that need changing without messing with anything that doesn't need to be fixed. Then you can repair the permissions with the utility on the install disk if you want to be sure that everything's right.

I believe default permissions for folders are drwxr-xr-x and the default for files is -rwx-r--r--

See http://docs.info.apple.com/article.html?artnum=25751

Nov 23, 2007 1:41 AM in response to biovizier

biovizier wrote:
These are "Finder" issues, and that is something Apple should fix.


First of all, I don't have any problems with Finder crashing when I click the lock on the Sharing & Permissions section of a Finder 'Get Info' window for files showing "(unknown)" as the group, nor does Spotlight have any problem indexing these files. Thus, I don't think this is inherently a Finder issue & is probably something users seeing crashes while doing this can fix without Apple changing the Finder.

One cause of crashes has always been bad preference files, so I wonder if users seeing this crash have tried removing any related ones.

Secondly, as several have pointed out, there is a difference between the "unknown" group & one without a name. However, Finder does not report the latter as in the unknown group but as "(unknown)." IOW, "unknown" is not the same thing as "(unknown)."

Nov 23, 2007 5:35 AM in response to R C-R

If you only clicked on the lock, then yes, finder will not crash. I received Finder crashes if I then attempt to remove the unknown user.

First of all, I don't have any problems with Finder crashing when I click the lock on the Sharing & Permissions section of a Finder 'Get Info' window for files showing "(unknown)" as the group

Nov 23, 2007 5:45 AM in response to Tony T1

I just followed the MacFixit instructions for rectifying the unknown group, and everything seems to be fine. I was hoping to fix two problems:

1) Repairing permissions from Disk Utility takes much longer than it should.
2) My Finder windows sometimes begin to blink like crazy, forcing me to restart the Finder.

Neither of these problems have been remedied though 😟

Is it possible that a 10.5.2 update from Apple could be problematic, now that I've change my GID manually by following these instructions?

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to Fix the Unknown Group (Permissions)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.