LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 08-01-2005, 03:54 PM   #1
dashnaam
LQ Newbie
 
Registered: Jul 2005
Location: Potsdam NY
Distribution: Fedora
Posts: 17

Rep: Reputation: 0
LAMP File and Directory permissions


I have an interesting question relating to file and directory permissions on a lamp server in a classroom environment.

I'm teaching a php programming class where my students need ssh, sftp access to the server, however I do not want them to be able to see each others files when using these services. Of course they would all be able to see the interpreted results of the program after the application server is finished, but they absolutely cannot see the source code!!! (it would make grading a moot point).

What would be the best way to accomplish the desired result? I'm running fc4 apache 2, php5 and mysql 4.xxx. Currently my DocRoot location is set for /usr/local/apache/htdocs. I was originally thinking of placing home directories under the aforementioned location --> but this cannot be the most secure solution.

Any ideas?? And thanks very much in advance for any/all help!!!

-D
 
Old 08-01-2005, 11:17 PM   #2
tkedwards
Senior Member
 
Registered: Aug 2004
Location: Munich, Germany
Distribution: Opensuse 11.2
Posts: 1,549

Rep: Reputation: 52
Code:
# Allow users to have their own public_html directory
UserDir public_html
UserDir disabled root
Now make that directory setgroup id:

Code:
chmod g+s /home/*/public_html
chown :apache /home/*/public_html
In /etc/profile add:
Code:
umask 0027
Now get them to put all their files in their public html directory. And do:
Code:
chmod -R o-rwx /home/*/public_html/
Now If you look in one of their public_html directories you should see permissions similar to this:
Code:
-rwxr-x---  1 tim apache 7000 Jul 19 22:02 index.php*
Where tim is the username, apache is the user that the apache server runs as and there are no permissions for the 'others' group. Now you just have to check that their umasks are 0027
and that they don't change them and that they don't use chmod to add permission for the others group.


If anyone has a cleaner way of doing this please speak up.

Last edited by tkedwards; 08-01-2005 at 11:18 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to fix file and directory permissions asif mushtaq Linux - General 2 07-13-2005 11:51 PM
samba file/directory permissions jonfa Linux - Networking 2 06-29-2005 08:03 AM
File/Directory Permissions waynevnc Debian 1 05-23-2005 04:23 PM
File and Directory permissions plasmapudding Red Hat 3 09-09-2003 10:26 AM
Directory and file permissions ryan Linux - Security 2 12-06-2000 12:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 03:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration