I think I am misunderstanding something here. I have made an easy python testing file to see how permissions affect the use of python files. I did so in order to be able to answer 64bit ubuntu 12.04 python cannot run an existing python file
SetUp
I have made a test.py file with the contents
print 'I am working'
Test case 1
ls -al test.py
-rw-r--r-- 1 joey joey 25 Dec 24 11:11 test.py
python test.py
I am working
- How come python is executing this file even though I did not do
chmod +x test.py
?
Test case 2
chmod 400 test.py
ls -al test.py
-r-------- 1 joey joey 25 Dec 24 11:11 test.py
python test.py
I am working
So apparently python only needs read permission in order to execute my file?
Test case 3
chmod 200 test.py
ls -al test.py
--w------- 1 joey joey 25 Dec 24 11:11 test.py
python test.py
python: can't open file 'testo.py': [Errno 13] Permission denied
Write permissions are insufficient (and for the record, only executable permissions are insufficient as well).
- How come python executes files without executable permissions?