2

I know what chmod (change mode) and what chown (change owner) do.

I also understand what the numbers mean after chmod do.

I was going through a docker tutorial and I saw chown 999 being used.

What does it mean and do?

1
2

who is the user 999? Is it just custom to him or a code used universally?

In Ubuntu and the Ubuntu family flavours, the numeric user ID in live sessions is 999. (The literal user ID is ubuntu, kubuntu, lubuntu ... xubuntu but in all these cases the numeric user ID is 999.)

When you boot from a USB drive, 'Try Ubuntu', you boot into a live session.

You can check with the command

grep 999 /etc/group

and you will find the user if you run a live session. Otherwise you will probably not find anything via that command.

The operating system used for the Docker tutorial is probably an installed system. And there seems to be a user ID with the numeric 999. It is possible to create such a user ID, but in an installed Ubuntu system there is no standard user with that numeric user ID.

0

As specify in chown man

chown - change file owner and group

This manual page documents the GNU version of chown. chown changes the user and/or group ownership of each given file. If only an owner (a user name or numeric user ID) is given, that user is made the owner of each given file, and the files' group is not changed.

It seems like at the example in the video, the instructor change the owner of the folder to be user-id 999

For example, in my machine, using gdm user-id is 130 and user logstash user-id is 999

gdm:x:130:135:Gnome Display Manager:/var/lib/gdm3:/bin/false

logstash:x:999:999:LogStash Service User:/usr/share/logstash:/usr/sbin/nologin

root# mkdir /tmp/a1
root# ll /tmp/a1
total 44
drwxr-xr-x  2 root root  4096 Jan 15 09:54 ./
drwxrwxrwt 27 root root 36864 Jan 15 09:54 ../
root# chown 130 /tmp/a1
root# ll /tmp/a1
total 44
drwxr-xr-x  2 gdm  root  4096 Jan 15 09:54 ./
drwxrwxrwt 27 root root 36864 Jan 15 09:54 ../

# grep 999 /etc/passwd
logstash:x:999:999:LogStash Service User:/usr/share/logstash:/usr/sbin/nologin
root# chown 999 /tmp/a1
root# ll /tmp/a1
total 44
drwxr-xr-x  2 logstash root  4096 Jan 15 09:54 ./
drwxrwxrwt 27 root     root 36864 Jan 15 09:54 ../
4
  • who is the user 999? Is it just custom to him or a code used universally? – YulePale Jan 15 '20 at 7:55
  • @YulePale updated my answer, in my machine logstash has user-id 999 – Yaron Jan 15 '20 at 7:59
  • 1
    UID 999 is possible, there are other posts on askubuntu referencing this UID, but it may be specific to each system. stackoverflow.com/q/1013516 mentions UIDs below 1000 are reserved for system users, but there is no official list of what those users may be and POSIX apparently doesnt enforce UIDs either. – Sergiy Kolodyazhnyy Jan 15 '20 at 8:17
  • According to stackoverflow.com/q/4159910/3701431 even root user isn't POSIXly required. – Sergiy Kolodyazhnyy Jan 15 '20 at 8:17

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.