I have 2 user userA and www-data
in group www-data
, on my web server I have php script that create folder and file
<?php
mkdir('dynamicDir');
file_put_contents('dynamicDir/z.txt', 'test');
output permission
drwxr-sr-x 2 www-data www-data 4096 Aug 19 23:33 dynamicDir
but when I run python script on shell using user userA
import os
os.remove('dynamicDir/z.txt')
I get error
Traceback (most recent call last):
File "p.py", line 4, in <module>
os.remove('dynamicDir/z.txt')
PermissionError: [Errno 13] Permission denied: 'dynamicDir/z.txt'
for already created folder/file I can use chmod -R g+rwx mydir/parentOfMyDir
but how for dynamic directory?