/etc/host (Mac users) No permission

Discussion in 'Jailbreaks and iOS Hacks' started by Chizzled, Sep 15, 2009.

  1. macrumors member

    Joined:
    Jul 12, 2009
    #1
    Hello,

    I followed the steps provided by the Dev team to prepare myself for future jailbreaks, but i do not have permission to save the file i needed to edit.

    Link...http://www.saurik.com/id/12#howto

    File to edit.../etc/hosts

    entered...74.208.105.171 gs.apple.com

    I could not save file. I changed permission to read and write, but still do not have permission to save file.

    I have Snow Leopard and iTunes 9.

    Anybody else have any success?
     
  2. macrumors Nehalem

    GoCubsGo

    Joined:
    Feb 19, 2005
    #2
    You need to be logged in as root before you can save to that file.
    You have to first enable the root user, log out and edit, log out and return to the admin or whatever account you use, and you should be set.
     
  3. macrumors 68030

    jared_kipe

    Joined:
    Dec 8, 2003
    Location:
    Seattle
    #3
    In case you haven't figured this out yet, if you're using the command line to edit the file. Just type in "sudo -s" and enter your password before you try to edit the file with nano or whatever editor you prefer.
     
  4. macrumors 6502a

    Joined:
    Jan 22, 2008
    #4
    You could also copy the host file to the desktop, edit it there, and then copy it back to /etc. When you do that, the computer will ask for your password to authenticate and you'll be all set.
     
  5. thread starter macrumors member

    Joined:
    Jul 12, 2009
    #5
    Done!

    Thanks you guys,

    I went ahead and edited the file under root user. To enable root user with Snow Leopard, follow the steps in the provided link...

    http://stringfoo.com/2009/09/07/tutorial-enabling-root-access-in-os-x-snow-leopard/

    When I opened the 'hosts' file, it automatically opened a 'hosts copy' file. I could not edit the original 'hosts' file. Instead, I edited the 'hosts copy' file, erased the original 'hosts', then renamed the 'hosts copy' to 'hosts.'

    Seems to work just fine.

    Hope this helps someone else as well.

    Thanks again for your super fast replies!!
     
  6. macrumors 68040

    ViViDboarder

    Joined:
    Jun 25, 2008
    Location:
    USA
    #6
    You can also use the command-line and use vi to edit it by doing
    Code:
    sudo vi /etc/hosts
    I believe. I did this when I was trying to make my fake .mac server. :D
     
  7. macrumors G4

    dhlizard

    Joined:
    Mar 16, 2009
    Location:
    The Jailbreak Community
    #7
    Just get TextWrangler (for Mac) it's free and does this simply. No terminal, just find the file, touch the pencil, edit and save.
     
  8. macrumors 6502a

    Joined:
    Jun 9, 2008
    #8
    How did you find this etc/host file?
     
  9. macrumors 68040

    ViViDboarder

    Joined:
    Jun 25, 2008
    Location:
    USA
    #9
    That's the full filepath... /etc/hosts
     
  10. macrumors 6502

    jaikob

    Joined:
    Jul 1, 2008
    Location:
    Freeland, MI
    #10
    technically it's /private/etc/hosts

    ;)
     
  11. macrumors 6502a

    Joined:
    Jun 9, 2008
    #11
    How do you find this without terminal, i can not see any folders called etc in finder.

    Text Wrangler requires you to find the file...

    In terminal I get after typing /etc/hosts

    -bash: /etc/hosts: Permission denied
     
  12. macrumors 6502a

    Joined:
    Jun 9, 2008
    #12
    Cant find that either and in Terminal still get permision error despite enabling acount as root and logging on and off again.

    Driving me nutz this. How long have I got to do this? 3GS JB 3.0
     
  13. macrumors 68030

    jared_kipe

    Joined:
    Dec 8, 2003
    Location:
    Seattle
    #13
    Well in finder you can use the menu option Go->GoToFolder
    In the popup dialog type "/etc"
    The hosts file will be in there.
    You can copy paste, but you may end up with bad permissions.

    You can right click hosts, and click the little lock icon at the bottom of it, authinticate and then change everyone acces to read/write.


    Then edit it with Textwrangler or whatever.
    Then change back the privileges if you want to.


    OR open terminal and type "sudo nano /etc/hosts" type in password (you won't see your password being typed so do it from memory)

    Edit with the keyboard arrows for moving around (no mouse), then press "control+o" then press return (to save the file). And reboot computer.

    EDIT: I routinely do this on mac and windows computers to allow a unique name website like blah.local to pass to a specific IP address on my network. This allows for MAMP to prototype websites in different OS/browser combinations even from within a virtual machine.
     
  14. macrumors 6502a

    Enigmafan420

    Joined:
    Apr 18, 2008
    Location:
    Puget Sound, U.S.A.
    #14
    Okay I just did this (basically) by copying hosts to the desktop, changing the permissions, then using textedit to add the line.

    I have a 3GS and 3.0.1. I KNOW I AM NOT SUPPOSED TO UPDATE YET :) But what do I do now? Should I Sync the phone? I have downloaded the 3.1 ipsw but not installed it yet, and I have set itunes (8.x.x) to not remind me again about the update.

    Cheers!
     
  15. macrumors 6502a

    Enigmafan420

    Joined:
    Apr 18, 2008
    Location:
    Puget Sound, U.S.A.
    #15
    Anyone?!?

    Thanks :)
     
  16. macrumors 603

    thelatinist

    Joined:
    Aug 15, 2009
    Location:
    Connecticut, USA
    #16
    In my opinion, the easiest way to edit hosts is to open terminal and type:

    Code:
    sudo nano /etc/hosts
    Edit the file, save (ctrl + o) and exit (ctrl + x).

    You don't need to do anything else. Now if you need to restore, you can do so using the 3.0 ipsw.

    And feel free to sync your iPhone as long as you are very careful not to upgrade.
     
  17. macrumors 6502a

    Enigmafan420

    Joined:
    Apr 18, 2008
    Location:
    Puget Sound, U.S.A.
    #17
    Okay done all this-thanks for the info. However, does doing this step mean I can restore 3.X AUTOMATICALLY? I thought that something had to be stored on Suarik's server and as far as I know, I have not stored the ECID there.

    Cheers! :)
     
  18. macrumors G4

    dhlizard

    Joined:
    Mar 16, 2009
    Location:
    The Jailbreak Community
    #18
    I enabled show hidden files so it would show up.
     

Share This Page