LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 11-05-2010, 04:19 PM   #1
pernest
LQ Newbie
 
Registered: Mar 2010
Posts: 10

Rep: Reputation: 0
preventing users from browsing filesystem


Hi

What methods exits to restrict which directories a user may browse on the filesystem. I want to prevent php scripts from being able to view system files. I've seen two solutions, but neither are satisfactory:
  • Chrooting a directory that the script is in, but this requires that all the necessary php libraries/files are moved/copied into the right place relative to the chroot directory. I don't feel that I have the technical ability to achieve this.
  • Putting php into safe mode and disabling *nasty* php functions. But this is ineffective if just one obscure *bad* php function is missed.
 
Old 11-05-2010, 04:48 PM   #2
CoffeeKing!!!
Member
 
Registered: Mar 2008
Posts: 117

Rep: Reputation: Disabled
Use the chmod command. Here's a breif consise tutorial. http://catcode.com/teachmod/

Chmod is very easy to use. Although there are othe methods like access control lists that you can use as well, chmod is the best place to start.

Last edited by CoffeeKing!!!; 11-05-2010 at 04:49 PM.
 
Old 11-05-2010, 05:22 PM   #3
pernest
LQ Newbie
 
Registered: Mar 2010
Posts: 10

Original Poster
Rep: Reputation: 0
Hi, and thanks for the response. Are you suggesting that I chomod the whole file system "chmod -R o-rwx"? Wouldn't this break stuff?

Basically if you created a new user, could you deny the whole filesystem to that users, everything under / accept for one specific location, say /var/www/http_docs

Like I said in my original post, I'm not confident to set up a chroot gaol with all the nessesary php files inside.

Quote:
Originally Posted by CoffeeKing!!! View Post
Use the chmod command. Here's a breif consise tutorial. http://catcode.com/teachmod/

Chmod is very easy to use. Although there are othe methods like access control lists that you can use as well, chmod is the best place to start.
 
Old 11-05-2010, 05:32 PM   #4
Web31337
Member
 
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
method 1(hard, though effective): chrooting PHP. described here and here.
method 2(easy): use open_basedir restriction.
method 3(easiest): chmod. To prevent other users from BROWSING(reading contents of directory) use chmod o-r. man chmod is a way to go.

Last edited by Web31337; 11-05-2010 at 05:35 PM.
 
1 members found this post helpful.
Old 11-05-2010, 06:09 PM   #5
pernest
LQ Newbie
 
Registered: Mar 2010
Posts: 10

Original Poster
Rep: Reputation: 0
Obviously its possible set the global read bit to 0 for every single file on the filessystem, but will this leave the machine in a working state? I would have thought that there are various bits and bobs that need the global read bit set on filesytem files in order to do their jobs properly.

Quote:
Originally Posted by Web31337 View Post
method 3(easiest): chmod. To prevent other users from BROWSING(reading contents of directory) use chmod o-r. man chmod is a way to go.
 
Old 11-09-2010, 10:48 AM   #6
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by Web31337
method 2(easy): use open_basedir restriction.
+1

This is the purpose of open_basedir.
 
  


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
[SOLVED] Preventing Users from Downloading Files from the Sever By Typing the URL Hi_This_is_Dev Linux - Security 7 09-19-2010 12:37 PM
Preventing users from excute commands camry Linux - Security 4 06-03-2009 11:21 AM
Preventing new users from posting links vharishankar LQ Suggestions & Feedback 8 09-16-2006 12:21 AM
Preventing users to bind server to ports 0-10000 Kostko Linux - Networking 0 08-27-2003 04:58 AM
preventing users to make outgoing connections Shroom Linux - Security 5 06-15-2003 05:57 AM

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

All times are GMT -5. The time now is 07:05 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