user group problem on Linux + Apache

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
ctmaster
Forum Newbie
Posts: 7
Joined: Wed Jul 08, 2009 10:45 pm

user group problem on Linux + Apache

Post by ctmaster »

Hi All,
I wanna modify folders and files on the remote server(Linux + Apache) with PHP, but all of the folders and files are usually '755' purview, I can't use php to modify them.

And if I change a folder to '777', so I can modify it and create files in it, but I can't use ftp account to modify it.

The server administrator told me he doesn't like I change them to '777', I just can use the purview '755'.

So I want to know How I can solve this problem, may be I can use php to login the linux.

Thanks for all your answers.
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

Re: user group problem on Linux + Apache

Post by kaisellgren »

ctmaster wrote:And if I change a folder to '777', so I can modify it and create files in it, but I can't use ftp account to modify it.
The files are 0777 and your FTP-client can't modify those files?
ctmaster
Forum Newbie
Posts: 7
Joined: Wed Jul 08, 2009 10:45 pm

Re: user group problem on Linux + Apache

Post by ctmaster »

kaisellgren wrote:
ctmaster wrote:And if I change a folder to '777', so I can modify it and create files in it, but I can't use ftp account to modify it.
The files are 0777 and your FTP-client can't modify those files?
Sorry, usually I create files by php script are '644', And I can't use ftp to delete it.
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

Re: user group problem on Linux + Apache

Post by kaisellgren »

ctmaster wrote:
kaisellgren wrote:
ctmaster wrote:And if I change a folder to '777', so I can modify it and create files in it, but I can't use ftp account to modify it.
The files are 0777 and your FTP-client can't modify those files?
Sorry, usually I create files by php script are '644', And I can't use ftp to delete it.
Ok, that makes sense. 0644 means that only the owner of the file (the one who created it) has rights to modify it. Try to CHMOD it to 0664 or 0666 or change the owner with CHOWN.
ctmaster
Forum Newbie
Posts: 7
Joined: Wed Jul 08, 2009 10:45 pm

Re: user group problem on Linux + Apache

Post by ctmaster »

So, thanks Kai.

But I have to know how can I use php script to get the purview, under '755' to modify the files and folders.
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

Re: user group problem on Linux + Apache

Post by kaisellgren »

ctmaster wrote:So, thanks Kai.

But I have to know how can I use php script to get the purview, under '755' to modify the files and folders.
chmod()/chown()?
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: user group problem on Linux + Apache

Post by VladSun »

There are 10 types of people in this world, those who understand binary and those who don't
Post Reply