 |
 |
modify & save hosts file
|
 |
|
 |
|
Mac Enthusiast
Join Date: Apr 2003
Location: manticore or people's republic of haven
Status:
Offline
|
|
i have searched and found some items similar, but nothing had the answer i am looking for: how do i save my edited hosts file? i'm running 10.4.3.
when i open /etc/hosts, with textedit or vi, it is opened as read-only and will not let me save it. i have set my permissions to 766 and 777, to make sure it is editable, but then i still cannot save my changes. in textedit when i save changes, i am told i can't save due to overwrite protection (i think that was the message) and when i choose to overwrite, it does not allow me to save. through vi, i get a message related to /private/etc/hosts.
do i need to change the permissions on /private/etc/hosts as well? or am i missing something very simple to let me save changes to /etc/hosts? i also tried to make the modification using NetInfo, and it does not save the change either.
thanks!
|
|
some people are like slinkys: they don't do much, but are fun to push down stairs.
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Apr 2002
Location: case.edu
Status:
Offline
|
|
Are you editing as root? (sudo vi /etc/hosts)
|
pb 1440x960 | 1.67, 1.5, 128, 80 | leopard
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Apr 2003
Location: manticore or people's republic of haven
Status:
Offline
|
|
Originally Posted by Tesseract
Are you editing as root? (sudo vi /etc/hosts)
i am. going in as root should protect from the overwrite protection, right?
|
|
some people are like slinkys: they don't do much, but are fun to push down stairs.
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2005
Location: Vancouver, BC
Status:
Offline
|
|
If a file is r-xr--r-- root/root, and you are su'ed as root, then you can still write to it simply because you are *root*, even though you don't have the "official" write flag. In vi/vim, rather than doing :w to write the file out, do :w! and it will force an overwrite.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Apr 2003
Location: manticore or people's republic of haven
Status:
Offline
|
|
Originally Posted by Tomchu
If a file is r-xr--r-- root/root, and you are su'ed as root, then you can still write to it simply because you are *root*, even though you don't have the "official" write flag. In vi/vim, rather than doing :w to write the file out, do :w! and it will force an overwrite.
thx; i will give that a shot (using :w!). if i were to use 'wq!' it will not have the same effect as 'w!' right?
su and sudo will give me the same rights, right?
|
|
some people are like slinkys: they don't do much, but are fun to push down stairs.
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Apr 2003
Location: manticore or people's republic of haven
Status:
Offline
|
|
Originally Posted by Tomchu
If a file is r-xr--r-- root/root, and you are su'ed as root, then you can still write to it simply because you are *root*, even though you don't have the "official" write flag. In vi/vim, rather than doing :w to write the file out, do :w! and it will force an overwrite.
thx; i will give that a shot (using :w!). if i were to use 'wq!' it will not have the same effect as 'w!' right?
su and sudo will give me the same rights, right?
|
|
some people are like slinkys: they don't do much, but are fun to push down stairs.
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Apr 2002
Location: case.edu
Status:
Offline
|
|
Originally Posted by zanyterp
thx; i will give that a shot (using :w!). if i were to use 'wq!' it will not have the same effect as 'w!' right?
:wq! is equivalent to :w! :q, IIRC.
Originally Posted by zanyterp
su and sudo will give me the same rights, right?
Generally, yes.
|
pb 1440x960 | 1.67, 1.5, 128, 80 | leopard
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Apr 2003
Location: manticore or people's republic of haven
Status:
Offline
|
|
thanks Tesseract.
got it to work on 10.4. before posting this, i had searched for the same thing and found mentions of a work-around/trick that needs to be done in 10.3.x? is that right? is this documented somewhere (i looked and couldn't find it in the forum)
thx!
|
|
some people are like slinkys: they don't do much, but are fun to push down stairs.
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|