<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="+1"><tt>Hi CLUEbies,<br>
<br>
I want to replace a normal file in a directory with a symlink to
somewhere else.&nbsp; 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.&nbsp; Unfortunately it seems that chattr
on ext{23} will not let me make a symlink be an immutable part of a
directory entry.<br>
<br>
$ touch oldfile<br>
$ ln -s oldfile newfile<br>
$ ls -al newfile<br>
lrwxrwxrwx&nbsp;&nbsp;&nbsp; 1 ockers&nbsp;&nbsp; ockers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7 Mar 31 13:54 newfile -&gt;
oldfile<br>
$ chattr +i newfile<br>
chattr: Operation not permitted while setting flags on newfile<br>
<br>
I've tried this a bunch of times on a variety of systems.&nbsp; Sometimes it
applies the chattr attribute to the oldfile, sometimes it just throws
an error, on CentOS too.&nbsp; 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?<br>
<br>
I can't make the directory itself immutable because that will break too
many things I think.<br>
<br>
Thanks,<br>
Jim<br>
</tt></font>
<pre class="moz-signature" cols="72">-- 
Jim Ockers, P.Eng. (<a class="moz-txt-link-abbreviated" href="mailto:ockers@ockers.net">ockers@ockers.net</a>)
Contact info: <a class="moz-txt-link-freetext" href="http://www.ockers.ca/pason.html">http://www.ockers.ca/pason.html</a>

</pre>
</body>
</html>