Johnny Kuo
Johnny Kuo

Reputation: 101

Why does the group of some file show number (looks like ID), not an alphabet string?

Normally as 'ls -al', the files always show like:

-rw-r--r-- 1 owner_name group_name size time file_name

But some of my files show:

-rw-r--r-- 1 owner_name 'number' size time file_name

And the 'number' does not exist in /etc/group

What does the 'number' mean? and how to fix it?

Many thanks!

Upvotes: 4

Views: 6067

Answers (2)

user2371524
user2371524

Reputation:

The number is the group ID (gid). Groups and Users in a *nix system are numerical IDs (uid and gid). In a file system, the owning user and group will only ever be stored by its ID.

To display this, the user database is queried. With a modern *nix system, this could be anything, e.g. an LDAP directory, but the classic format is using the files /etc/passwd and /etc/group. If you see an ID instead of a name, it means your system couldn't find the entry in the user/group database. With a remote LDAP directory, this happens e.g. when the network is down. If you just use a traditional /etc/group file, this only happens when there is no entry.

Either the group was deleted or somebody changed the group of the file using a (non-existing) ID instead of a name or the file was copied from another system having this group and preserving the IDs while copying.

How to fix it depends on what you want. You can just chgrp the file to an existing group. Or you can create a group with this ID.

Upvotes: 5

Raman Sailopal
Raman Sailopal

Reputation: 12887

The numbers will be the group id's as opposed to the group name. To display group id's without group names, you can use ls -aln.

If a number shows amongst the names this is normally an issue with group name resolution i.e. if a group of files have been downloaded from an outside source and the group id's/names are "foreign" and therefore not understood by the local system.

Upvotes: -2

Related Questions