Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Help needed with Terminal - (sudo nano /private/etc/hosts and password). Can you help?

I need to preview files being migrated before changing the DNS. The instructions were to go to Terminal and put in sudo nano /private/etc/hosts & then my password. I closed the window to find my password, now its not prompting me for the password.


I understand that terminal doesn't operate with prompts or responses, but the log-in isn't being populated as it was when I first opened up the screen.


Please note - I don't know what I'm doing here, just following instructions from HostGator and have fallen over at the first fence!


Help would be very much appreciated (in baby language!). Thank you...

MacBook Pro, Mac OS X (10.6.8)

Posted on May 6, 2013 5:33 PM

Reply
9 replies

May 7, 2013 3:56 AM in response to KezzaB3

I need to preview files being migrated before changing the DNS. The instructions were to go to Terminal and put in sudo nano /private/etc/hosts & then my password. I closed the window to find my password, now its not prompting me for the password.

When you open the Terminal.app the application creates an instance of your shell in that window (screen). When you close the window that instance of your shell is killed. So, when you create a new window another instance of your shell is created. Thus, the new process does not "remember" what you were "typing" in the process that was killed.


If you were to open multiple windows in the Terminal.app each window has its own instance of your shell. Each act independently of each other.

May 7, 2013 6:31 AM in response to WZZZ

Yes am trying to modify host files.


Instruction in an email (little garbled with font):


"Step 1 – Open the Terminal.app


Either by start typing Terminal on the Spotlight, or by going into Applications -> Utilities -> Terminal.


Step 2 – Open the hosts file


Open the hosts by typing on the Terminal that you have just opened:


sudo nano /private/etc/hosts


Type your user password when prompted.


Step 3 – Edit the hosts file


The hosts file contains some comments (lines starting with the # symbol), as well as some default hostname mappings (e.g. 127.0.0.1 – localhost).

Simply append your new mappings underneath the default ones.

You can navigate the file using the arrow keys.


XXX.XXX.XXX.XXX DOMAIN.COM WWW.DOMAIN.COM


Replace DOMAIN.COM with your actual domain name. Additional domains, sub-domains or addon domains can be added at the end of the line separated by spaces.


Step 4 – Save the hosts file


When done editing the hosts file, press control-o to save the file.

Press enter on the filename prompt, and control-x to exit the editor.


Step 5 – Flush the DNS cache


On Leopard you can issue a simple Terminal command to flush the DNS cache, and have your host file changes to take immediate effect:


dscacheutil -flushcache


NOTE: this ONLY works on the computer where you changed the 'hosts' file....."

May 7, 2013 6:56 AM in response to KezzaB3

After you enter


sudo nano /private/etc/hosts


you should be prompted for your admin password. Are you? What's happening then exactly? And is your account standard or admin?'


Note: when you enter your admin password you won't see it anywhere. Just enter it and hit return. And if you're running from a standard account, you'll have an extra step to take. Post back if that's the case. And don't close the window. Keep going.

May 7, 2013 3:06 PM in response to WZZZ

<you should be prompted for your admin password. Are you?>


No, as I keep saying there is no prompt.


<What's happening then exactly? >


Nothing. the shell is empty and there is no prompt or anything just the square cursor>


<And is your account standard or admin?'>


Not sure but I think admin but the look of the password setup.



- how do I get the password prompt? -

Help needed with Terminal - (sudo nano /private/etc/hosts and password). Can you help?

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