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?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityI 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?
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.
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 ../