3

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
devel:x:503:anthony,lexsys

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?

1
  • Try: mount -o remount,rw / then edit the file again and try to save.
    – user267812
    Jan 30, 2015 at 8:09

1 Answer 1

11
  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
    
2
  • 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, 2009 at 8:57
  • You can find out about 1. with the id command. For 2. You can call mount without arguments. Jan 30, 2015 at 12:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .