LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-03-2009, 03:35 AM   #1
h725
Member
 
Registered: Apr 2008
Posts: 114

Rep: Reputation: 15
safe_mode question


hi,

I'm trying to understand safe_mode in php.
I put safe_mode = On in php.ini

After, I've created a little php file, owned by my normal user, while apache2 is running as www-data.

Why I'm able to call the script via browser?
 
Old 02-04-2009, 12:46 AM   #2
Undeadzz
LQ Newbie
 
Registered: Apr 2008
Posts: 28

Rep: Reputation: 16
if the browser is able to call the script thats normal, its probly allowed by the apache configuration?
 
Old 02-04-2009, 02:02 AM   #3
h725
Member
 
Registered: Apr 2008
Posts: 114

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Undeadzz View Post
if the browser is able to call the script thats normal, its probly allowed by the apache configuration?
I don't understand.. if safe_mode is ON, and the script's uid is different than www-data, why I'm able to execute the script?
 
Old 02-04-2009, 04:23 PM   #4
h725
Member
 
Registered: Apr 2008
Posts: 114

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by h725 View Post
I don't understand.. if safe_mode is ON, and the script's uid is different than www-data, why I'm able to execute the script?
Ok, I found the explanation in this link:

http://it2.php.net/manual/en/ini.sect.safe-mode.php

Quote:
When safe_mode is on, PHP checks to see if the owner of the current script matches the owner of the file to be operated on by a file function or its directory. For example:

-rw-rw-r-- 1 rasmus rasmus 33 Jul 1 19:20 script.php
-rw-r--r-- 1 root root 1116 May 26 18:01 /etc/passwd

Running script.php:
<?php
readfile('/etc/passwd');
?>
results in this error when safe mode is enabled:

Warning: SAFE MODE Restriction in effect. The script whose uid is 500 is not
allowed to access /etc/passwd owned by uid 0 in /docroot/script.php on line 2

..which is a little different than simply open a php file via browser.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Running SquirrelMail with safe_mode = on DorbeshBaba Linux - Security 0 11-05-2007 04:32 AM
Workaround safe_mode - I`m using cPanel - do the experts here have a solution ? bin_asc Linux - Security 4 08-30-2006 03:13 PM
Question, Apples Contribution to Open Source + MacOs file structure question Higgy3k Other *NIX 5 07-25-2005 04:23 AM
php + safe_mode issue Ateo Linux - Software 1 06-03-2005 01:54 PM
Not your regular GRUB question - just a short question for a fried MBR!! ziphem Linux - General 3 01-31-2005 01:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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