View the Most Wanted LQ Wiki articles.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-29-2006, 12:11 PM   #1
Registered: Mar 2003
Posts: 36

Rep: Reputation: 15
mkdir with root privileges

I am trying to create folders with a php website so users can login to an ftp session to drop files.
the script makes the directory but won't chown to the user name I want. the user name on the folder is apache.
What is the command for mkdir in php that will allow this chown as well.

I was looking for tips on using sudo for it but couldn't get it to work.
Old 09-29-2006, 01:07 PM   #2
Senior Member
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78

If I am misunderstanding please explain your problem in more detail.
Old 09-29-2006, 02:15 PM   #3
Registered: Mar 2003
Posts: 36

Original Poster
Rep: Reputation: 15
I have been to that page before and it states that the superuser is the only one that has privleges to chown. However I should be able to sudo or something to give apache the right to chown the directory. or chmod it.

If I manually chown the folder to username then username can ftp to it.
I want to have my php script create the folders and chown (change the owner)them.
Old 09-29-2006, 05:22 PM   #4
Registered: Mar 2003
Posts: 36

Original Poster
Rep: Reputation: 15
I worked this out a different way.
Instead of directly running the command I put it in a batch script
then I run the batch file with
shell_exec ('sh /var/scriptname');

and now its working.


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
USB HD Needs Root Privileges rrrssssss Linux - Hardware 3 11-13-2005 04:08 PM
Root privileges for user ar1 Linux - Security 2 01-07-2005 09:33 PM
mkdir in / with out being root Gustaf Slackware 5 10-21-2004 02:39 PM
How to mount without root privileges? ni0wn Slackware 3 09-15-2004 05:03 PM
root privileges and permissions evil_lafta Slackware 7 08-20-2003 09:37 PM

All times are GMT -5. The time now is 02:45 PM.

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