Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having issues setting permissions for a specific user.

I have a directory /srv/git/ in which I'm trying to create a sub-directory test containing one file testfile (owned by www:www-data). testfile should only readable and writable by user and group and nobody else.

[root@bartplatak ~]# cd /srv/git
[root@bartplatak git]# mkdir test && touch test/testfile
[root@bartplatak git]# chown -R www:www-data test
[root@bartplatak git]# chmod o= test/testfile
[root@bartplatak git]# chmod -R ug=rw test
[root@bartplatak git]# sync
[root@bartplatak git]# su www

However for some unknown reason, I cannot cd into the directory (and listing it shows very incomplete information)

bash-4.1$ pwd

bash-4.1$ ls -la test
ls: cannot access test/.: Permission denied
ls: cannot access test/testfile: Permission denied
ls: cannot access test/..: Permission denied
total 0
d????????? ? ? ? ?            ? .
d????????? ? ? ? ?            ? ..
-????????? ? ? ? ?            ? testfile

bash-4.1$ cd test
bash: cd: test: Permission denied

What strikes me as odd is the fact that .. shows incomplete information despite being accessible (drwxr-xr-x 6 root root 4096 Mar 1 19:02 .).

EDIT: The machine I'm running this on is a VPS with CentOS release 6.5 (Final).

Linux 2.6.32-042stab078.28 #1 SMP Mon Jul 8 10:17:22 MSK 2013 x86_64 x86_64 x86_64 GNU/Linux

SELinux is (as far as I can see) disabled

[root@bartplatak ~]# sestatus 
SELinux status:                 disabled

Permissions on the directory (and parents) are set as

drwxr-xr-x 6 root root     4096 Mar  1 19:02 /
drwxr-xr-x 5 root root     4096 Mar  1 14:16 /srv
drwxr-xr-x 6 root root     4096 Mar  1 19:02 /srv/git
drw-rw-r-x 2 www  www-data 4096 Mar  1 19:02 /srv/git/test
-rw-rw---- 1 www  www-data    0 Mar  1 19:02 /srv/git/test/testfile

[root@bartplatak git]# stat /srv/git/test
  File: `/srv/git/test'
  Size: 4096        Blocks: 8          IO Block: 4096   directory
Device: 5ae0b691h/1524676241d   Inode: 404068      Links: 2
Access: (0665/drw-rw-r-x)  Uid: (  497/     www)   Gid: (  496/www-data)

[root@bartplatak git]# stat /srv/git/test/testfile
  File: `/srv/git/test/testfile'
  Size: 0           Blocks: 0          IO Block: 4096   regular empty file
Device: 5ae0b691h/1524676241d   Inode: 404071      Links: 1
Access: (0660/-rw-rw----)  Uid: (  497/     www)   Gid: (  496/www-data)

After su www, id shows uid=497(www) gid=497(www) groups=497(www),496(www-data)

share|improve this question
up vote 8 down vote accepted

The obvious problem is that /srv/git/test does not have the executable x bit set for owner and group. Thus it is not possible to traverse the directory.

Resolve the issue with:

chmod ug+x /srv/git/test
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.