Linux could write to read only files on FreeBSD NFS server

Luoqi Chen luoqi.chen at gmail.com
Thu Feb 27 23:31:26 UTC 2020


On Thu, Feb 27, 2020 at 3:12 PM Alan Batie <alan at peak.org> wrote:

> On 2/27/20 2:58 PM, Luoqi Chen wrote:
> > One more piece of information that might help: this behavior started
> > somewhere between centos 5 and 6, kernel 2.6.18 and 2.6.32, i.e., the
> same
> > script would fail on 2.6.18. Timing wise I believe it coincided with the
> > introduction of nfsv4.
> >
> > Even if this is a linux bug, given its dominant position, we don't have
> > much of a choice but to try to be compatible. Does anyone have say access
> > to a netapp and see how it behaves?
>
> Is this what you mean?
>
> <admin03.peak.org> [101] $ df .
> Filesystem           1K-blocks     Used Available Use% Mounted on
> filer01-cvo.peak.org:/vol/admin
>                      167772160 73704064  94068096  44% /filer01/cvo-admin
> <admin03.peak.org> [102] $ rm -f x
> <admin03.peak.org> [103] $ touch x
> <admin03.peak.org> [104] $ chmod 000 x
> <admin03.peak.org> [105] $ ls -l x
> ----------. 1 alan wheel 0 Feb 27 15:01 x
> <admin03.peak.org> [106] $ echo foo > x
> -bash: x: Permission denied
> <admin03.peak.org> [107] $ chmod 600 x
> <admin03.peak.org> [108] $ cat x
> <admin03.peak.org> [109] $ cat /etc/redhat-release
> CentOS release 6.10 (Final)
>
>
> This works the same way on a truenas server:
>
> <admin03.peak.org> [122] $ rm x
> <admin03.peak.org> [123] $ df .
> Filesystem             1K-blocks     Used   Available Use% Mounted on
> tnas01-cvo.fs10g.peak.org:/mnt/zdata/nfs/admin
>                      78257431296 54539008 78202892288   1%
> /tnas01-cvo/admin
> <admin03.peak.org> [124] $ touch x
> <admin03.peak.org> [125] $ chmod 000 x
> <admin03.peak.org> [126] $ ls -l x
> ----------. 1 alan wheel 0 Feb 27 15:05 x
> <admin03.peak.org> [127] $ echo foo > x
> -bash: x: Permission denied
> <admin03.peak.org> [128] $ chmod 600 x
> <admin03.peak.org> [129] $ cat x
> <admin03.peak.org> [130] $
>
> However it also does the same on a native FreeBSD 11 server:
>
> <zbackups02.peak.org> [116] $ uname -a
> FreeBSD zbackups02.peak.org 11.3-RELEASE-p3 FreeBSD 11.3-RELEASE-p3 #0:
> Mon Aug 19 21:08:43 UTC 2019
> root at amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
>
> <zmail03-admin.peak.org> [105] $ cat /etc/redhat-release
> CentOS release 6.10 (Final)
> <zmail03-admin.peak.org> [106] $ df .
> Filesystem            1K-blocks     Used  Available Use% Mounted on
> zbackups02.peak.org:/zbackups/zmail03-admin
>                      5039303296 91682304 4947620992   2% /zbackups
> <zmail03-admin.peak.org> [107] $ touch x
> <zmail03-admin.peak.org> [108] $ chmod 0 x
> <zmail03-admin.peak.org> [109] $ ls -l x
> ----------. 1 alan root 0 Feb 27 15:08 x
> <zmail03-admin.peak.org> [110] $ echo foo > x
> -bash: x: Permission denied
> <zmail03-admin.peak.org> [111] $ chmod 600 x
> <zmail03-admin.peak.org> [112] $ cat x
>

Yes, except to leave the read bit(s) on. I can confirm that the write would
fail on centos 6/7/8 if all bits are cleared.


More information about the freebsd-fs mailing list