Permission not allowed?? need help please

Discussion in 'Site & Server Administration' started by rcpalace, Nov 3, 2007.

  1. #1
    Hi guys, I'm trying to modify the hosts file in linux '/etc/hosts/' but it's set to read-only and I can't modify it. I tried chmodding the file but It didn't work. I tried chmodding it to the following:
    chmod 720 /etc/hosts
    chmod 644 /etc/hosts
    chmod 700 /etc/hosts
    chmod 670 /etc/hosts
    chmod 600 /etc/hosts
    chmod 644 /etc/hosts

    but it only seems to open under 644 but no modifying allowed. Any help would be greatly appreciated.
    Kind Regards.
     
    rcpalace, Nov 3, 2007 IP
  2. ThreeGuineaWatch

    ThreeGuineaWatch Well-Known Member

    Messages:
    1,489
    Likes Received:
    69
    Best Answers:
    0
    Trophy Points:
    140
    #2
    Which user are you logged in as when you attempt to chmod it? The
    /etc/hosts 
    Code (markup):
    file should be owned by root and the wheel group so regular users will not be able to change its permissions.

    Also, it might have an extended file flag set. If you
    $ man chflags 
    Code (markup):
    you will find out about these extra flags and how they are used.
     
    ThreeGuineaWatch, Nov 4, 2007 IP
  3. Sebastian Rametta

    Sebastian Rametta Peon

    Messages:
    13
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    do this on the file:

    lsattr /etc/hosts

    See what the "real attributes are".

    if it shows an attirbute with an "i" lke this:
    ----i--------

    Then it has the unmutable bit set (spellling)

    As root run this on it:

    chattr -i /etc/hosts

    Then try setting your permissions as needed and editing the content of the file, you host probably did this while hardening the box from hackers 'n such.

    - Sebastian Rametta
     
    Sebastian Rametta, Nov 4, 2007 IP