I'm having an error for what seems to be a permissions problem when trying to create a zip file in a specified folder testfolder
-folder has the following permissions:
drwxr-xr-x 193 nobody nobody
When trying to launch the following command in python I get the following:
p= subprocess.Popen(['7z','a','-pinfected','-y','/home/John/testfolder/yada.zip'] + ['test.txt'],stdout=PIPE.subprocess,stderr=PIPE.subprocess)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/local/lib/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
OSError: [Errno 13] Permission denied
Any idea what wrong with permissions?
I pretty new to it, my python runs from /usr/local/bin path
drwxr-xr-x
means that:
1] only the directory's owner can list its contents, create new files in it (elevated access) etc.,
2] members of the directory's group and other users can also list its contents, and have simple access to it.
So in fact you don't have to change the directory's permissions unless you know what you are doing, you could just run your script with sudo
like sudo python my_script.py
.