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.

What is the best way to grant sudo privileges to a user only for the /opt/myapp directory as if the user were root in CentOS?

The idea is to allow developers to do whatever they want only on the /opt/myapp directory but to avoid for example that they remove some important directory or shutdown the server.

share|improve this question

migrated from stackoverflow.com Jan 31 '13 at 16:17

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

3  
If you merely want a user to have full read/write/execute permission on /opt/myapp, then set the permissions that way. If you want something else, you will need to clarify. –  William Pursell Jan 31 '13 at 13:59
    
Perhaps the solution is to give each of them (or the whole bunch) a virtual machine? –  vonbrand Jan 31 '13 at 19:11

3 Answers 3

Perhaps, you could use chroot environment

http://www.serverschool.com/dedicated-servers/how-to-build-a-chroot-environment-in-centos/

share|improve this answer
    
Please don't just provide links for your answers. What happens when that page is moved/deleted? –  Lee Taylor Feb 25 '13 at 15:31

There are two really simple ways of doing this:

1) If you want everyone to see it you can change the permissions (chmod 421 /opt/myapp) where 4 is read 2 is write and 1 is execute

2) If you want only one person to view it you can change the owner of the file (chown newOner /opt/myapp)

Both of these will most likely require root

share|improve this answer

First, define (within /etc/sudoers) a Cmnd_Alias for the commands you want the user to be able to run: Cmnd_Alias MYAPPS = /opt/myapp/some_executable, /opt/myapp/another_one Then create a user rule that allows them to run them some_user ALL = MYAPPS

share|improve this answer

Your Answer

 
discard

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