I did ll on one of my directories, what does 999 means here,

drwxr-xr-x  9 git       mysql 4096 Nov 12 14:41 gitlab/
drwxr-xr-x  6 gitlab_ci   999 4096 Jun 28 13:36 gitlabci/

could these directories be fully owned like gitlab is owned by git and gitlabci to be owned by gitlab_ci

I want something like this

drwxr-xr-x  9 git       git 4096 Nov 12 14:41 gitlab/
drwxr-xr-x  6 gitlab_ci gitlab_ci 4096 Jun 28 13:36 gitlabci/
  • sudo chown git:git gitlab – gronostaj Nov 12 '13 at 10:21
  • There is indeed 2 diffrent issues, but the first isn't one. – mveroone Nov 12 '13 at 15:38

If it can't show both the full username and group name in the space allotted, ls will replace one or both with the user or group ID instead rather than truncate either, in order to reduce or eliminate security issues due to similar user or group names with different length. It will not expand the column. You cannot change that.

  • Is this behavior documented? The ls on Debian indeed expanded the owner/group columns: -rw-r--r-- 1 messagebus winbindd_priv 0 12. Nov 15:13 test, messagebus and winbindd_priv were the longest user/group names I could find ;) – mpy Nov 12 '13 at 14:16
  • 3
    @mpy: I have not found any specific documentation that describes this. I would not be surprised to find that various distros implement differing behavior. – Ignacio Vazquez-Abrams Nov 12 '13 at 14:23

File don't have owner and group saved as names in their metadata, but as UID and GID.

If the OS cannot resolve those IDs to names, they show the ID as is.

The resolving process uses /etc/nsswitch.conf to know where to look. (file, ldap, database, etc.)

I suppose that getent group gitlab_ci will not return anything, meaning the group doesn't exist. If it doesn't that mean this group doesn't have GID 999 which explains why your file show bogus.

Use chgrp to modify its GID.

  • 1
    I can confirm that, when an ID cannot be resolved to a name, the ID is used instead. – Avery Payne Nov 12 '13 at 16:53

I'm late to answer, but I've seen the 999 user used for MySQL in some distros. If your distro is not using the 999 user, then it is possible that the directory is shared with, or was copied from, another machine.

Just as an example, I have a 999 user in the following directory, for which no user exists on my machine:

$ ls -l mysql_data/
total 176188
-rw-rw---- 1 999 999       56 Jul 10 12:41 auto.cnf
-rw-rw---- 1 999 999 79691776 Jul 11 09:45 ibdata1
-rw-rw---- 1 999 999 50331648 Jul 11 09:45 ib_logfile0
-rw-rw---- 1 999 999 50331648 Jul 10 12:41 ib_logfile1
drwx------ 2 999 999    45056 Jul 10 17:03 magento
drwx------ 2 999 999     4096 Jul 10 12:41 mysql
drwx------ 2 999 999     4096 Jul 10 12:41 performance_schema

$ grep 999 /etc/passwd

But if we examine the Docker container which mounts this directory, we find:

$ docker-compose exec mysql grep 999 /etc/passwd

This container's image is the official Docker MySQL image:

$ grep -A1 -P "^\s*mysql:" docker-compose.yml
    image: mysql:5.6.40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.