Edit files as administrator

Discussion in 'Mac Basics and Help' started by yesiam, Sep 26, 2017.

Tags:
  1. yesiam macrumors newbie

    yesiam

    Joined:
    Sep 26, 2017
    #1
    Hello guys,

    I have an issue with the admin rights on my yosemite os.
    Even though I am logged in as an administrator, I don't have permission to edit some of the system files (e.g hosts file).
    I totally don't get it. Do you have any clue why is that so and how can I gain permission to edit my files?

    Thanks a lot, I would appresiate your help.
     
  2. BrianBaughn macrumors 601

    BrianBaughn

    Joined:
    Feb 13, 2011
    Location:
    Baltimore, Maryland
    #2
    See if you can copy the file to the desktop, make another copy of that as a backup, edit the first copy, then drop the edited version back to the original location to overwrite with authentication.
     
  3. yesiam thread starter macrumors newbie

    yesiam

    Joined:
    Sep 26, 2017
    #3
    Yay! It works!

    T h a n k s, Brian.

    I owe you a good beer ;)
     
  4. ocabj macrumors 6502a

    ocabj

    Joined:
    Jul 2, 2009
    #4
    Who exactly are you logged in as? /etc/hosts should be owned by root. You still need to sudo to edit root owned files unless you actually logged in as root.
    Code:
    $ ls -al /etc/hosts
    -rw-r--r--  1 root  wheel  307 Sep 20 06:32 /etc/hosts
    $ sudo vi /etc/hosts
    Password:
    
     

Share This Page