views:

21

answers:

2

for example, if i'm using a php script that writes files, or using a cms , the files and folders that are generated are owned by a special user (f.e. www-data:www-data)

is it possible to change this default user for special directories? so that for example all cms systems or php scripts in general use another user and group in the dir /httpdocs/somedir?

A: 
  • What do you want to do with these special directories?
  • Who/what will be able to access these directories?
  • What kind of special permissions needed?

For example:

If you want to access files via FTP that are uploaded via the administration panel (www-data) you need to adjust permissions on this folder. You can create a special group under your OS like ftpweb, add your www-data and FTP-user to this group then change the folders' group to this so both www-data and your FTP-user can access.

Edit:

groupadd ftpweb
usermod www-data -a -G ftpweb
usermod your_ftp_user -a -G ftpweb
chgrp ftpweb your_special_dir
fabrik
sounds good. can you give me a short hint how to create a group and assign users to it?
choise
@choise: Edited. Note: i don't know anything about your current settings please do these modifications carefully. I've also provided some useful links.
fabrik
+1  A: 

As far as I know, It's only possible if you run PHP as CGI (rather than Apache module). For instance, FastCGI allows to use suexec:

Álvaro G. Vicario
you are right. poorly my php is not running as cgi
choise