unable to edit hosts file in terminal

I have read all over and I cannot save the hosts file in terminal.

In the terminal I see:
iMAC:~ Amber$
I type:
sudo pico /etc/hosts it asks for password then I hit return but then nothing happens.
iMAC:~ Amber$

If I type:
pico /etc/hosts it opens the file but I am unable to save it.
It says:
Error writing /etc/hosts: Permission denied

I'm not sure what to do.
Please help.

iMAC 24" 2.33 Intel Core 2 Duo / 3GB Ram / 500GB HD / 7600GT 256MB SDRAM, Mac OS X (10.5.6)

Posted on Mar 8, 2009 2:57 PM

Reply
5 replies
Sort By: 

Mar 8, 2009 3:08 PM in response to Joel Fuller

Joel Fuller wrote:
I'm having trouble with 10.5 Terminal also. It's not obeying permissions.

Terminal has nothing to with obeying permissions.
It shows as properly chmod'ing, but doesn't. If I copy the files to 10.4 it works fine.

I suggest reposting in the Unix forum
http://discussions.apple.com/forum.jspa?forumID=735
Reply

Mar 8, 2009 3:10 PM in response to FastPhotoLab

FastPhotoLab wrote:
I have read all over and I cannot save the hosts file in terminal.

In the terminal I see:
iMAC:~ Amber$
I type:
sudo pico /etc/hosts it asks for password then I hit return but then nothing happens.
iMAC:~ Amber$

If I type:
pico /etc/hosts it opens the file but I am unable to save it.
It says:
Error writing /etc/hosts: Permission denied

I'm not sure what to do.
Please help.


It sounds like you have a blank admin password. sudo will not work with a blank password. you need to change you password to a nonblank one. then rerun the command and enter the password when prompted after
sudo pico /etc/hosts
Reply

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

unable to edit hosts file in terminal

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.