choise
choise

Reputation: 25244

change default user of webserver for special directories

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?

Upvotes: 2

Views: 569

Answers (2)

Álvaro González
Álvaro González

Reputation: 146573

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:

Upvotes: 1

fabrik
fabrik

Reputation: 14365

  • 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

Upvotes: 0

Related Questions