Harry Cameron Harry Cameron - 2 years ago 62
Git Question

Assigning certain commands to users

I want to only allow the "git" userto be able to run git commands, I edited my sudoers file using

sudo visudo
and added

# Cmnd alias specification
Cmnd_Alias GIT_CMDS = /usr/bin/git

# User privilege specification

When I then try to run git commands from the git user I get an error saying I do not have the correct access rights.
How can I fix this?

Answer Source

"access right" might be different from "command execution right"

git could still be able to run git commands, but might not be able to update a folder not owned by git/git group.

That is why you have questions like "Allow User 'git' to run 'git pull' as 'www-data' via sudo", in order to allow

 sudo -u www-data git <a command>

In your case, since you have specified (ALL), check if your access error goes aways with the proper sudo -u <auser> when you run commands as git in a folder not owned by git.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download