Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

These are permissions:

$ ls -l | grep view.tmpl
-rw-rw-r-- 1 apache  devel  1057 2009-04-30 00:39 view.tmpl

I(lexsys) am in group developers:

$ cat /etc/group | grep devel

But when I open the file, it shows like read-only:

"view.tmpl" [readonly] 31L, 1057C

and when I try to write it with w command, I get an error:

"view.tmpl" E212: Can't open file for writing

How can I set permissions to allow lexsys editing the file?

share|improve this question
Try: mount -o remount,rw / then edit the file again and try to save. – user267812 Jan 30 at 8:09

1 Answer 1

up vote 10 down vote accepted
  1. How recently were you (lexsys) added to the devel group? If you were added after your current login session, then you need to log out and then log back in again.

  2. Is the filesystem that contains view.tmpl mounted read-only? This may be by design (examine /etc/fstab), or it may be because it's an ext3 fs mounted with the "errors=remount-ro", which causes the fs to be remounted read-only if any errors are detected while accessing the fs.

  3. Has someone used chattr to set the immutable flag on view.tmpl? check this with lsattr. If it is set, use 'chattr -I view.tmpl' to clear it (as root).

    An immutable file will look something like this with lsattr:

    $ lsattr /tmp/foo
    ----i-------------- /tmp/foo
share|improve this answer
The first answer was right. I used to Lock screen, not Log out, when I go away. So when I did logout/login, everything became fine. – lexsys Aug 10 '09 at 8:57
You can find out about 1. with the id command. For 2. You can call mount without arguments. – Mathias Weidner Jan 30 at 12:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.