4
1
I'm trying to edit /etc/hosts using Vi in Cygwin but it's read only. Is there a command similar to sudo? How do I edit a read-only file?
Thanks
4
1
I'm trying to edit /etc/hosts using Vi in Cygwin but it's read only. Is there a command similar to sudo? How do I edit a read-only file?
Thanks
2
Try doing a forced overwrite. Instead of :wq
to write and quit, try: :wq!
to force write and quit.
7
Opening your cygwin shell as Administrator will grant your user root access. Then the files will no longer be readonly.
1@Nope You should accept the newer answer posted by Philipp if you ever sign on again! – Matthew – 2014-09-30T21:06:19.050
Didn't work.... – Nope – 2011-03-20T17:57:52.657
3Try using the Windows
runas
command then?runas /user:Administrator vi /etc/hosts
– Majenko – 2011-03-20T17:59:21.0203Running cygwin as administrator allowed me to edit the file. Thanks for your help – Nope – 2011-03-20T18:05:45.160