I have a php script uploading files to a certain folder, currently they are uploading as a 'psacln' group, so that I can delete the files via FTP. This was all working fine when PHP was running as FastCGI, I had to change PHP to run as Apache Module in order to get a php extension to work. But now I can't delete files via PHP script because permission is denied. I assume because now the group 'Apache' is trying to delete the file that belongs to 'psacln'. How do I allow apache to delete those files?
EDIT: ls -alF
drwxr-xr-x 2 fugitiveink psacln 4096 Nov 13 14:05 92/
drwxr-xr-x 2 fugitiveink psacln 4096 Nov 13 06:57 93/
drwxr-xr-x 2 fugitiveink psacln 4096 Nov 13 14:12 95/
drwxr-xr-x 2 fugitiveink psacln 4096 Dec 21 18:56 96/
drwxr-xr-x 2 fugitiveink psacln 4096 Dec 21 08:30 97/
drwxr-xr-x 2 fugitiveink psacln 4096 Nov 13 14:26 98/
drwxr-xr-x 2 fugitiveink psacln 4096 Nov 13 14:28 99/
There may be some cases where you have to give the web server write permission to a file, or to a directory - this can be achieved by doing sudo chmod g+w /var/www/html/PATH (where PATH is the path to the file or folder in the directory structure where you need to apply the write permissions for the web server).
In the Permission Set Group detail page, under Permission Sets, click Permission Sets in Group. Click Add Permission Set. You can add up to 100 permission sets to a permission set group. On the Add Permission Sets detail page, select the permission sets that you want to add to the group, and click Add.
I assume that you have shell and root access to this system. If so, you can try adding the apache user (typically apache
or www-data
) to the /etc/group
file.
The proper way to do this is to use usermod
, though I typically just edit the file directly.
In short if your apache user is apache
, try:
sudo usermod apache --append --groups psacln
This basically gives the apache user access to any files & directories that are owned by the psacln group.
If this doesn't work, post an example of your directory with the file permissions (ls -alF
) and we can work from that.
EDIT:
To directly edit the groups file using nano (substitute with whichever editor you're comfortable with):
sudo nano /etc/groups
and find the psacln
group and add the apache
user:
psacln:x:130:apache
Note that the gid (130
) will undoubtedly be different.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With