The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
mkdir mirusnet UNIX for Advanced & Expert Users 3 02-23-2008 05:00 AM
mkdir big123456 Shell Programming and Scripting 2 07-22-2006 07:23 AM
install vs mkdir thmnetwork Linux 1 03-30-2005 08:25 PM
Can't mkdir in /home leond UNIX for Dummies Questions & Answers 5 03-05-2003 07:04 AM
mkdir limitations flignar UNIX for Dummies Questions & Answers 12 08-30-2002 11:30 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-15-2006
Registered User
 

Join Date: Jun 2006
Posts: 9
Stumble this Post!
calling mkdir from PHP (Solved)

Edit: From a post in this topic, found out that my problem wasn't what I thought it was, and ended up solving my problem in aonther topic: http://www.unix.com/showthread.php?p...#post302076761




Hi, I'm not sure if this is a Unix problem or a PHP problem, but I'll see if anyone here knows.

So I have a PHP script that calls shell_exec('mkdir thefolder'); - for anyone who doesn't know php, shell_exec just throws a command at the command shell. "thefolder" is able to be created, BUT it is somehow created as read-only. When I click the file in Windows and try to uncheck the read-only, it won't let me. I tried deleting it through Unix, didn't work. The only way I could delete the folder was to use shell_exec('rm thefolder'); in PHP.

Now this makes no sense to me, shell_exec is just supposed to send a command to the Shell. calling 'mkdir thefolder' in Unix does not create it as read only, despite being the same command. As well, 'rm thefolder' does not work in the normal Unix, but the PHP script calls it fine.

I'm so confused. Any Ideas?

Thanks,
Graeme

Last edited by gmclean2006; 06-15-2006 at 08:29 AM.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 06-15-2006
Moderator
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,432
Stumble this Post!
The PHP is running on a Web server (e.g. Apache) with the identity of a special user (e.g. nobody), and it makes sense that only that user on the system is able to remove the directory created by himself. Most Unix Web servers today are installed this way.
Reply With Quote
  #3 (permalink)  
Old 06-15-2006
Registered User
 

Join Date: Jun 2006
Posts: 9
Stumble this Post!
Ok thanks, that makes sense.

But I'd assume if I could have it chmod'd so that all users have write access then there wouldn't be a problem? If thats the case then the other thread that i just posted "chmod - "future" changes", if that can get solved, it will probably solve the problem.
Reply With Quote
  #4 (permalink)  
Old 06-15-2006
Registered User
 

Join Date: Jun 2006
Posts: 9
Stumble this Post!
oh but one question, is there anyway to change the user PHP is calling as from "nobody" to something else a little more secure?
Reply With Quote
  #5 (permalink)  
Old 06-15-2006
Moderator
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,432
Stumble this Post!
No, at least on the user (script) level.

However, you can configure Apache to run CGI scripts (recall that PHP scripts may be executed as CGI scripts with PHP CGI executable) in suEXEC mode, which allows scripts to run with the privileges of the script owner instead of the server user. But as I said, few servers I have seen are configured this way with suEXEC.

http://httpd.apache.org/docs/2.2/suexec.html
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:26 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0