8

I installed anaconda on our new VM and I can't list its contents. I can change my directory to .../anaconda/ but when I type ls -l I get:

ls: cannot open directory .: Permission denied

However, when I enter:

sudo ls -l

I get

total 92
drwxrwxrwx.   2 gcw8 PosixUsers 12288 May 26 15:30 bin
drwxrwxrwx.   2 gcw8 PosixUsers 12288 May 26 15:30 conda-meta
drwxrwxrwx.   3 gcw8 PosixUsers  4096 Mar 27 16:33 docs
drwxrwxrwx.   2 gcw8 PosixUsers  4096 Mar 27 16:33 envs
drwxrwxrwx.   2 gcw8 PosixUsers  4096 Mar 27 16:33 etc
drwxrwxrwx.   6 gcw8 PosixUsers  4096 May 26 15:19 Examples
drwxrwxrwx.  41 gcw8 PosixUsers  4096 May 26 15:19 include
drwxrwxrwx.  11 gcw8 PosixUsers 20480 May 26 15:19 lib
-rw-rwxrwx.   1 gcw8 PosixUsers  3700 Nov  7  2013 LICENSE.txt
drwxrwxrwx. 185 gcw8 PosixUsers 12288 May 26 15:30 pkgs
drwxrwxrwx.   3 gcw8 PosixUsers  4096 Mar 27 16:33 plugins
drwxrwxrwx.  10 gcw8 PosixUsers  4096 Mar 27 16:33 share
drwxrwxrwx.   3 gcw8 PosixUsers  4096 Mar 27 16:48 ssl

The groups command indicates that I'm a member of PosixUsers and I'm the one who initially created this so why can't I access it? At one point I ran chmod -R ugo+rwx .../anaconda/ but I still don't see how that would result in this error. If anything, it should alleviate it. I'm running CentOS and all of this is being done via ssh. Can anyone see the problem?

13

Note the . at the end of the permissions (drwxrwxrwx.): that means there's an SELinux context involved. You need to get that right for your user to be able to list the contents of the directory.

To see the contexts for your directory, run

sudo ls -alZ

(the -Z option shows the SELinux contexts required).

The CentOS wiki has a good page on SELinux. You'll find more information about the last character in the permissions at '+' and 's' in permission strings.

  • @son_of_fire: Stephen is right, + is for any other combination of access restrictions, . is reserved for SELinux only. IMO would belong into the answer, though. – 0xC0000022L Jun 10 '15 at 15:19

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.