file io - Python script to change resolv.conf [Permission issue] -


hey everybody, newbie @ python. wanted write script in python change dns.

but learned resolv.conf read-only file, after writing code. because took error: ioerror: [errno 13] permission denied: '/etc/resolv.conf'

myfile= open("/etc/resolv.conf", "w") 

then, made little search , found os.chmode() , wrote new line remove privileges of resolv.conf is:

os.chmod("/etc/resolv.conf", 0777) 

but i'm taking error: ioerror: [errno 13] permission denied: '/etc/resolv.conf'

i can't on question , i'm waiting advices.

thank you.

/etc/resolv.conf typically owned root. unless script run in such way has root privileges, won't able change file.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -