problem removing directory

Jez Hancock jez.hancock at munk.nu
Sun May 18 04:14:26 PDT 2003


On Sun, May 18, 2003 at 01:02:13PM +0200, Alex de Kruijff wrote:
> Hi,
> 
> I wanted to move /var/tmp to /tmp and symlink it for security reasons.
> I move /var/tmp to /var/tmp-old and copied the files to /tmp and them 
> symlink /var/tmp to /tmp. So far so good.
> 
> However, now i am unable to remove one directory and need some help in
> removing this.
> 
> Intranet# ll
> total 1
> dr-xr-xr-x  2 root  wheel  512 Mar 16 22:04 empty/
> Intranet# pwd
> /var/tmp-old/temproot/var
> Intranet# ll
> total 1
> dr-xr-xr-x  2 root  wheel  512 Mar 16 22:04 empty/
> Intranet# rm -rf *
Try:
chflags -R noschg * in /var/tmp/

Presumably you ran mergemaster at some point which creates the
/var/tmp/temproot hierarchy and sets some system 'immutable' flags on
some of the files in there to stop them being modified.  Running
'chflags noschg' removes the immutable flag.

For more info, man chflags and man ls

Specifically try ls -loR /var/tmp/

For example on my system:
[12:13:19] munk at users /home/munk# ls -lo /kernel
-r-xr-xr-x  1 root  wheel  schg 3132649 Apr 18 14:42 /kernel

you can see the 'schg' flag is set on kernel to stop it being modified.

Jez


More information about the freebsd-questions mailing list