Host file modification

Joined
Jul 11, 2008
Messages
11
Reaction score
0
Points
1
I am trying to edit the host file on a leapord computer. I have been able to open the file and edit the file. The issue is that it keeps telling me that I do not have rights to save the file. It does not allow me to edit the file then save it. I try to open the file using the sudo command followed by the open /private/etc/hosts It asks for a password and either tells me incorrect password, or it just goes down like I typed it in correctly but does not open the file. I have also turned on the root user and changed the password of the root user. This still tells me that I have the wrong password. The goal is to edit the hosts file and save it.
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
the password required is the user in sudoers.. that is.. your password. Assuming you're logged on as an administrative user. What are you trying to change in hosts?
 
OP
M
Joined
Jul 11, 2008
Messages
11
Reaction score
0
Points
1
I am trying to add the ip address of our intranet website. So the computer knows where to go. I found out a solution that worked for me. I will add it in the next post.
 
OP
M
Joined
Jul 11, 2008
Messages
11
Reaction score
0
Points
1
Answer

First you have to enable the root user on the Leapord. It is defaulted that the root user is turned off on Leapord. To turn it on go to:

Application-utilities-Directory utility.app
unlock it if it is locked
click edit- enable root user and then type in the root user password that you want to make it.

Then you have to allow finder to show the hidden files and folders. To do this go to a terminal

application-utility-terminal
in terminal type
defaults write com.apple.finder AppleShowAllFiles -bool true
press return
then type in killall Finder
press return and then the screen will flicker.

Now click on your hardrive
click on the private folder to highlight it
click apple I at the same time to view the folder permissions
at the bottom of the folder permission page that pops up there will be a spot labelled sharing and permissions
click on add user it is a little plus sign
add the user that you are logged into as to the folder.
Give the user read and write permissions then
click apply to enclosed items.

Now go back to finder and open
private-etc-hosts
Host should open in editor if not click apple I and change it to open in editor. Add whatever to the host file and click on save. This should allow you to save the changes to the file. Without doing all these steps I was getting an error saying that I did not have the rights to modify and save the file.

Hope this helps someone. It was a pain for me.
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
You do not have to enable root. sudo su - and you will be root. You also do not need to make all items visable in Finder, ls -a will do the same in terminal. Nano and vi work quite well for editing. Lets not make it more complicated than need be. Actually, I'd sudo su - then
echo "xxx.xxx.xxx.xxx hostname" >> etc/hosts
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top