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?

choise
  • 24,636
  • 19
  • 75
  • 131

2 Answers2

1

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 González
  • 142,137
  • 41
  • 261
  • 360
0
  • 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
  • 14,094
  • 8
  • 55
  • 71
  • sounds good. can you give me a short hint how to create a group and assign users to it? – choise Aug 23 '10 at 10:40
  • @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 Aug 23 '10 at 10:53