[clue-tech] ext3 and immutable symlink?

David L. Willson DLWillson at TheGeek.NU
Wed Mar 31 14:53:33 MDT 2010


Not a solution, but more information.  Privilege appears to be relevant.
The "operation not permitted" message seems to be because you're not a privileged user.
Root gets "operation not supported" instead.
Regular users can add immutable, but can't remove it.  :-?
$ touch test
$ ln -s test testlink
$ chattr +i test
chattr: Operation not permitted while setting flags on test
$ chattr +i testlink
chattr: Operation not supported while reading flags on testlink
$ lsattr test*
-----------------e- test
lsattr: Operation not supported While reading flags on testlink
$ sudo chattr +i test
$ sudo chattr +i testlink 
chattr: Operation not supported while reading flags on testlink
$ lsattr test*
----i------------e- test
lsattr: Operation not supported While reading flags on testlink
$ 

David L. Willson
Trainer, Engineer, Enthusiast
MCT MSCE Network+ A+ Linux+ LPIC-1 NovellCLA UbuntuCP
tel://720.333.LANS
Freeing people from the tyranny (or whatevery) of Microsofty-ness

----- "Jim Ockers" <ockers at ockers.net> wrote:

> Hi CLUEbies,
> 
> I want to replace a normal file in a directory with a symlink to
> somewhere else. I also want this change to be permanent and immutable;
> that is, I want nothing and nobody to be able to get rid of the
> symlink and rewrite it with a normal file. Unfortunately it seems that
> chattr on ext{23} will not let me make a symlink be an immutable part
> of a directory entry.
> 
> $ touch oldfile
> $ ln -s oldfile newfile
> $ ls -al newfile
> lrwxrwxrwx 1 ockers ockers 7 Mar 31 13:54 newfile -> oldfile
> $ chattr +i newfile
> chattr: Operation not permitted while setting flags on newfile
> 
> I've tried this a bunch of times on a variety of systems. Sometimes it
> applies the chattr attribute to the oldfile, sometimes it just throws
> an error, on CentOS too. Can anyone suggest a reliable way to make my
> symlink itself immutable without having chattr try to apply the change
> in attributes to the target of the symlink?
> 
> I can't make the directory itself immutable because that will break
> too many things I think.
> 
> Thanks,
> Jim
> --
> Jim Ockers, P.Eng. ( ockers at ockers.net )
> Contact info: http://www.ockers.ca/pason.html 
> _______________________________________________
> clue-tech mailing list
> clue-tech at cluedenver.org
> http://cluedenver.org/mailman/listinfo/clue-tech


More information about the clue-tech mailing list