6

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
11
4

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.

5
  • When I run chmod 755 bad_dir I got chmod: changing permissions of 'bad_dir': Permission denied Jul 25 '14 at 12:36
  • @Garath, you should disable your selinux temporarily and then try. See my updated answer.
    – Ramesh
    Jul 25 '14 at 12:36
  • I doesnt' work. See my update Jul 25 '14 at 12:39
  • @Garath: What's the output of command getenforce? Please run setenforce 0 and not echo 0 > /selinux/enforce.
    – Cyrus
    Jul 25 '14 at 16:42
  • Could you do a getfacl bad_dir ? Maybe it's just an ACL to fix :)
    – ludiegu
    Jul 26 '14 at 10:00
2

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.

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.