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
Post a Comment