3

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!

3 Answers 3

3

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.

1

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.

1

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.

You must log in to answer this question.

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