8

I have following directory (/usr/local)

rwxr-xr-x. 43 root root  4096 Jul 25 14:19 .
rwxr-xr-x. 14 root root  4096 Feb 21 10:27 ..
rwxr-xr-x.  2 root root  4096 Jun 28  2011 bin
[...]
rwxr-xr-x   1 root root  8192 Jul 25 13:41 bad_dir
rwxr-xr-x.  4 root root  4096 Mar 28 11:56 good_dir

I am logged as root. When I run chown root:root good_dir everything is ok, but when I run chown root:root bad_dir I got chown: changing ownership of '/usr/local/bad_dir': Permission denied

What is wrong with bad_dir? What should I change to make chown working correctly? I see a dot in the end of permissions, but I don't know what does it mean.

Update

Running

echo 0 > /selinux/enforce
chmod 755 bad_dir

gives also chmod: changing permissions of 'bad_dir': Permission denied

Update 2

Output of ls -la /usr is

total 128
drwxr-xr-x.  14 root root  4096 Feb 21 10:27 .
dr-xr-xr-x.  24 root root  4096 May 28 08:22 ..
dr-xr-xr-x.   2 root root 28672 Jun 27 10:29 bin
drwxr-xr-x.   2 root root  4096 Jun 28  2011 etc
drwxr-xr-x.   2 root root  4096 Jun 28  2011 games
drwxr-xr-x.  36 root root  4096 Jul 23 14:04 include
dr-xr-xr-x.  12 root root  4096 Apr 11 17:10 lib
dr-xr-xr-x.  45 root root 36864 Jul 23 14:04 lib64
drwxr-xr-x.  14 root root  4096 Mar 28 11:58 libexec
drwxr-xr-x.  43 root root  4096 Jul 25 14:34 local
drwxr-xr-x.   3 root root  4096 Feb 21 10:27 man
dr-xr-xr-x.   2 root root 12288 Jul 23 14:04 sbin
drwxr-xr-x. 106 root root  4096 Mar 28 12:00 share
drwxr-xr-x.   4 root root  4096 Nov 20  2013 src
lrwxrwxrwx.   1 root root    10 Nov 20  2013 tmp -> ../var/tmp
Piotr Stapp
  • 1,003

2 Answers2

6

The directories need x permission to open. You can probably do,

chmod 755 bad_dir and then try your chown command.

According to here, the dot at end means,

According to ls.c (line 3785), . means an SELinux ACL. (+ means a general ACL.)

If it is SELinux messing, use setenforce to modify its mode. Run setenforce 0 to put SELinux in permissive mode and setenforce 1 to put it back into enforcing mode.

Ramesh
  • 39,297
3

I made a stupid mistake. We had few machines provisioned identically, but one (with this problem) was changed by one of my colleagues.

The bad_dir was mounted NFS, which explains all problems. Thanks to Joel Davis which suggest me to check this again I solved my issue.

Piotr Stapp
  • 1,003