Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been searching and reading through documents all morning and understand that I need to use some combination of chown and probably 'jailing' to securely give programmers access to directories on my centos webserver.

Here's the situation: I have an apache web server that has any number of virtual sites located in /var/www/site1 /var/www/site2 etc..

I have different developers that need full access both ssh and vsFTP to only the site they are working on. What is the best way to create and maintain security in this scenario. My thought would be to create a new user for each coder, jail that user to the website directory they are allowed to work in, add their user to a group and set the webroot's owner to that group.

Any thoughts? Good, bad, ugly? Thanks!

share|improve this question
add comment

migrated from stackoverflow.com Mar 25 '10 at 5:24

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

2 Answers

To start, remove vsFTP ASAP. Throwing source code and passwords over the internet in plain text is an extremely bad idea. FTP should ONLY be used for anonymous file transfer, sftp or ftp+ssl should be used and remove redundancy. Having 2 daemons makes you twice as vulnerable to exploitation, think about reducing attack surface as much as possible.

A traditional Chroot jail is probably overkill although it could get the job done. There are 2 threats you have to worry about. The first is that a user can download/modify code using ssh. This can be defended against by using the ChrootDirectory configuration in your sshd config file:

ChrootDirectory Specifies a path to chroot(2) to after authentication. This path, and all its components, must be root-owned directories that are not writable by any other user or group. After the chroot, sshd(8) changes the working directory to the user's home directory.

The next threat is that the programmer could upload malicious code, such as a PHP backdoor to gain access to your system. This is far more insidious because a backdoor could be as simple as adding 2 characters or removing 2 characters.

The most secure approach to the threat of a malicious insider is to use svn+ssh, force each programmer to do development on their local system and then review all code that is submitted. SVN will keep track of who has added what code to your system. After you have tested the code for vulnerabilities, ether intentional or accidental then you deploy a "release" build on your live server. Doing development on a live server is a bad idea as it leads to accidental down time during development.

share|improve this answer
add comment

Instead of a chroot, apache's suexec module is a great option to prevent abuse.

Otherwise I'd second "unknown"'s comment.

share|improve this answer
add comment

Your Answer

 
discard

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