example of files with there permissions
-rwxr-xr-x. 1 root root 659 Jan 4 2018 zookeeper-server-initialize
-rwxr-xr-x. 1 root root 649 Jan 4 2018 zookeeper-server-cleanup
-rwxr-xr-x. 1 root root 648 Jan 4 2018 zookeeper-server
-rwxr-xr-x. 1 root root 303 Jan 4 2018 zookeeper-client
-rwxr-xr-x. 1 root root 6822 Jan 4 2018 zkServer.sh
-rwxr-xr-x. 1 root root 12 Jan 4 2018 zkServer-initialize.sh
-rwxr-xr-x. 1 root root 2840 Jan 4 2018 zkEnv.sh
-rwxr-xr-x. 1 root root 1709 Jan 4 2018 zkCli.sh
-rwxr-xr-x. 1 root root 2155 Jan 4 2018 zkCleanup.sh
in case we have just this file for example : ( without the dot )
-rwxr-xr-x 1 root root 2155 Jan 4 2018 zkCleanup.sh
Then what is the command to add this dot to the file permissions ?
second how to add a dot recursive
for example on all sub folders under
/usr/hdp/current/zookeeper-server
example before
pwd
/usr/hdp/current/zookeeper-server
ls -Z
drwxr-xr-x root root ? bin
lrwxrwxrwx root root ? conf -> /etc/zookeeper/2.6.4.0-91/0
drwxr-xr-x root root ? doc
drwxr-xr-x root root ? etc
drwxr-xr-x root root ? lib
drwxr-xr-x root root ? man
drwxr-xr-x root root ? usr
-rw-r--r-- root root ? zookeeper-3.4.6.2.6.4.0-91.jar
lrwxrwxrwx root root ? zookeeper.jar -> zookeeper-3.4.6.2.6.4.0-91.jar
expected output:
pwd
/usr/hdp/current/zookeeper-server
ls -Z
drwxr-xr-x. root root system_u:object_r:bin_t:s0 bin
lrwxrwxrwx. root root unconfined_u:object_r:usr_t:s0 conf -> /etc/zookeeper/2.6.4.0-91/0
drwxr-xr-x. root root system_u:object_r:usr_t:s0 doc
drwxr-xr-x. root root system_u:object_r:usr_t:s0 etc
drwxr-xr-x. root root system_u:object_r:lib_t:s0 lib
drwxr-xr-x. root root system_u:object_r:usr_t:s0 man
drwxr-xr-x. root root system_u:object_r:usr_t:s0 usr
-rw-r--r--. root root system_u:object_r:usr_t:s0 zookeeper-3.4.6.2.6.4.0-91.jar
lrwxrwxrwx. root root system_u:object_r:usr_t:s0 zookeeper.jar -> zookeeper-3.4.6.2.6.4.0-91.jar
we try
restorecon -r /usr/hdp
ls -ltr
total 12
drwxr-xr-x. 27 root root 4096 Oct 29 10:05 2.6.0.3-8
drwxr-xr-x 29 root root 4096 Nov 6 11:29 2.6.4.0-91
drwxr-xr-x. 2 root root 4096 Dec 31 13:01 current
but 2.6.4.0-91 folder with the same permissions ( include the sub folders under 2.6.4.0-91 )
ls -Z
drwxr-xr-x. root root system_u:object_r:usr_t:s0 2.6.0.3-8
drwxr-xr-x root root ? 2.6.4.0-91
drwxr-xr-x. root root unconfined_u:object_r:usr_t:s0 current