Variant behaviour from truncate over NFS and UFS
Bruce Evans
brde at optusnet.com.au
Fri Nov 16 05:38:20 PST 2007
On Thu, 15 Nov 2007, Kris Kennaway wrote:
> I came across the following variant behaviour. On NFS:
>
> hydra1# cd /nfs
> hydra1# touch foo
> hydra1# chmod a-w foo
> hydra1# ls -l foo
> -r--r--r-- 1 4294967294 wheel 0 Nov 15 21:57 foo
> hydra1# truncate -s 0 foo
> truncate: foo: Permission denied
> hydra1# chmod u+w foo
> hydra1# truncate -s 0 foo
>
> Compare to UFS:
>
> hydra1# cd /tmp
> hydra1# touch foo
> hydra1# chmod a-w foo
> hydra1# truncate -s 0 foo
> hydra1# ls -l foo
> -r--r--r-- 1 root wheel 0 Nov 15 21:57 foo
>
> Which is correct?
Both, I think. truncate(2) requires write permission, and root always
has write permission, but root isn't really root for the nfs case.
Anyway, the default of maproot=-2 gives much more annoying nonstandard
behaviour than this -- it often prevents root doing things that normal
users can do.
Bruce
More information about the freebsd-standards
mailing list