Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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 encounter a very very strange problem today... I followed a link to install GitLab on my Linux server today, in the Gitolite section, there are two lines to set permission and ownership of a folder:

sudo chmod -R ug+rwXs,o-rwx /home/git/repositories/
sudo chown -R git:git /home/git/repositories/

And before these lines, it created a user and added it to a specific group:

sudo adduser --disabled-login --gecos 'GitLab' gitlab
sudo usermod -a -G git gitlab

I checked the user and permissions after these steps:

gitlab@vm-leader:/home/git$ id
uid=1001(gitlab) gid=1001(gitlab) groups=1001(gitlab),105(git)
gitlab@vm-leader:/home/git$ ls -al
total 56
drwxr-xr-x 8 git  git  4096 Jan  4 16:55 .
drwxr-xr-x 7 root root 4096 Jan  4 11:50 ..
-rw------- 1 git  git    87 Jan  4 17:02 .bash_history
drwxr-xr-x 2 git  git  4096 Jan  4 14:04 bin
drwx------ 2 git  git  4096 Jan  4 14:04 .cache
-r--r--r-- 1 root root  398 Jan  4 14:04
drwxr-xr-x 5 git  git  4096 Jan  4 14:01 gitolite
drwxr-x--- 6 git  git  4096 Jan  4 14:04 .gitolite
-rw-r--r-- 1 git  git  5064 Jan  4 14:04 .gitolite.rc
-rw-r--r-- 1 git  git    37 Jan  4 14:04 .profile
-rw-r--r-- 1 git  git    12 Jan  5 19:43 projects.list
drwsrws--- 6 git  git  4096 Jan  5 17:29 repositories
drwx------ 2 git  git  4096 Jan  5 19:43 .ssh

Based on these output, I believe the folder 'repositories' is allowed for same group users to access, in this case, the group 'git' has permission to access this folder. Also, the user 'gitlab' is belongs to the group 'git'. So the 'gitlab' user should be ABLE to access that folder. However, I got this

gitlab@vm-leader:/home/git$ cd repositories/
bash: cd: repositories/: Permission denied

This is too strange for me and I completely have no idea why this happened or how to fix it. Anyone can give me a hint? Thanks in advanced.

Additional Information:

bear@vm-leader:/home/git$ ls -ld /home/git
drwxr-xr-x 8 git git 4096 Jan  4 16:55 /home/git
share|improve this question

migrated from Jan 5 '13 at 13:29

This question came from our site for professional and enthusiast programmers.

@izomorphius: The question will almost certainly get migrated there, and the OP doesn't need to do anything for that to happen. – NPE Jan 5 '13 at 12:36
Have you logged out gitlab and then logged in again, so the new group gets active? – ott-- Jan 5 '13 at 16:48
@ott I'm sure I logged gitlab out and in...... – Lingfeng Xiong Jan 5 '13 at 16:53
Can you show the output of id as gitlab? – ott-- Jan 5 '13 at 16:54
I have learned the hard way that you have to have execute (x) permissions on a folder to cd into it. – BenjiWiebe Jan 5 '13 at 17:48

It seems, that /home/git have 700 permission. Adding execute permission for group (g+x) to /home/git allows you to get access:

# chmod g+x /home/git
share|improve this answer
I'm sorry but 'repositories' is the folder I cannot access to. And it DO has execute permission for group 'git', you can see this from the output of 'ls' command. – Lingfeng Xiong Jan 5 '13 at 16:36
I mean x permission for /home/git folder also. Please provide the 'ls -ld /home/git' output. – dchirikov Jan 5 '13 at 17:37
I have already attached that in my original post :-) – Lingfeng Xiong Jan 6 '13 at 1:10
up vote 0 down vote accepted

This problem has been solved! I mounted that folder(repositories) via NFS, and in NFS server, both git and gitlab users are non-existed. I added them and set proper groups for them, and everything goes well! I did some tests about this -- only when both server and client are set proper user/group, the permissions works correctly.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .