Create a file in /etc/ as a non-root user

Luca Cerone luca.cerone at gmail.com
Fri May 31 05:27:18 EDT 2013


> fd = open('/etc/file','w')
> 
> fd.write('jpdas')
> 
> fd.close()
> 
> 
Hi Bibhu, that is not a Python problem, but a permission one.
You should configure the permissions so that you have write access to the folder.
However unless you know what you are doing it is discouraged to save your
file in the /etc/ folder.

I don't know if on Mac the commands are the same, but in Unix systems (that I guess Mac is) you can manage permissions with chmod.



More information about the Python-list mailing list