I am reading a blog to integrate EFK(a log system) into k8s in centos 7.4. There are following instructions:
# mkdir ~/es_data
# chmod g+rwx es_data
# chgrp 1000 es_data
# chown 1000 -R es_data
# ls -l /root/es_data/
total 8
drwxrwxr-x 2 1000 1000 4096 Jun 8 09:50 ./
drwx------ 8 root root 4096 Jun 8 09:50 ../
I log in as root. The instructions say, If I do chgrp 1000 es_data and chown 1000 -R es_data, the director's owner and group would be 1000. But when I follow the instructions:
I see following:
drwxr-xr-x. 2 master16g master16g 6 Jul 11 15:27 es_data
The owner and group appears to machine hostname, master16g
.
Could someone drop me hints what happens here for chgrp 1000 and chown 1000
?
chown
changes the owner, chgrp
changes the group. Because you have user and group both named master16g
having 1000
as UID and GID respectively, this is why you see the user name and the group name on the list. chown
accepts UID as parameter as well as username, this is well documented in the manual. chgrp
also accepts GID and group name. You can change both also with one command chown 1000:1000 es_data -R
or chown master16g:master16g es_data -R
.
First Linux user has usually UID/GID 1000.
For instance, if you chown 0:1000 file
you will see root:master16g
as the file owner.
You can get uid and gid of the elasticsearch
user as follows (if it exists):
getent passwd "elasticsearch" | cut -d: -f3
getent group "elasticsearch" | cut -d: -f3