Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to create a user on linux with access rights only to one folder.

Background:

I have installed git on my virtual server (Debian). I also created a user for the repository. There is a lot of private data on the server. But all folders have read-access for others, because it's needed for the applications which run on the server. So the git-user can see all the data.

I would like to restrict the git user only to the folder where the repository is installed. I also tried ACL, but it didn't work.

Is there a better way to do this?

Thanks in advance!

share|improve this question

migrated from stackoverflow.com Nov 10 '12 at 4:40

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

3 Answers 3

You should look into Gitolite, which allows you to set up Git access on a server via SSH without giving access to anything else. It works by setting up the user so instead of executing a shell, it executes a process that understands just the commands Git needs to operate on the server, and nothing else. You can also set up multiple accounts, based on SSH keys, with only one Unix user account.

share|improve this answer

I have solved the problem by myself. Gitolite sounds very well, but is too much overhead for my problem.

I only created a new user on my server and changed his shell to the git-shell like this

chsh -s /usr/bin/git-shell gituser

Now i created a git and ensured, that the user has the required rights for the folder.

share|improve this answer

This answer was intended for SFTP, but it should be identical to set up Different Article. Just be sure that GIT user does not belong to a user group that could override the user privileges, such as root or admin.

share|improve this answer

Your Answer

 
discard

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.