From owner-freebsd-questions@FreeBSD.ORG Wed May 12 09:35:37 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E0A9716A4CE for ; Wed, 12 May 2004 09:35:37 -0700 (PDT) Received: from ipb.redline.ru (ipb.redline.ru [217.144.98.242]) by mx1.FreeBSD.org (Postfix) with ESMTP id A8A8643D5C for ; Wed, 12 May 2004 09:35:36 -0700 (PDT) (envelope-from zakharov@ipb.redline.ru) Received: from winmez ([192.232.12.250]) by ipb.redline.ru (8.12.9/8.12.9) with SMTP id i4CGZRYG072350; Wed, 12 May 2004 20:35:31 +0400 (MSD) (envelope-from zakharov@ipb.redline.ru) Message-ID: <001b01c4383f$331cd840$0101a8c0@winmez> From: "Mikhail E. Zakharov" To: "Charles Swiger" References: <1672830687.20040512113148@ipb.redline.ru> Date: Wed, 12 May 2004 20:34:54 +0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 cc: freebsd-questions@freebsd.org Subject: Re: NFS-bug or not ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2004 16:35:38 -0000 > On May 12, 2004, at 3:31 AM, Mikhail E. Zakharov wrote: > > When playing with NFS under FreeBSD, I've noticed something strange. > > You know it's impossible to export 2 directories of the same file > > system on the server to the 1 nfs-client: > > server# cat /etc/exports > > /usr/c client > > /usr/d client > > server# killall -HUP mountd > > server# showmount -e > > /usr/c Everyone > > > > There is no /usr/d exported. And we got errors in /var/log/messages: > > mountd[377]: can't change attributes for /usr/d > > mountd[377]: bad exports list line /usr/d > > Please refer to _Managing NFS and NIS_, O'Reilly, p92: > > "2. You cannot export any subdirectory of an exported filesystem unless > the > subdirectory is on a different physical device. > > 3. You cannot export any parent directory of an exported filesystem > unless > the parent is on a different physical device." > > Basicly, NFS exports work on a per-filesystem basis, although one can > use symbolic links to achieve results similar to what you are trying to > do by exporting different subdirectories of the same filesystem. > > There's a more extensive writeup about this here: > > http://www.pkix.net/~chuck/doc/NFS/article.html > > But it's possible(!) to fool mountd when using the -network key. > > Let's try to export /usr/a as read-only system for the whole network, > > and /usr/b writable for one host, and not readable for other. NB! Our > > NFS-client (192.168.12.98) is from 192.168.0.0/16 network. See this > > example: > [ ... ] > > When we mounted them on client. Let's make additional tests: > > client# echo "something stupid" > /mnt/test.txt > > client# echo "something stupid1" > /mnt1/test1.txt > > client# cat /mnt/test.txt > > something stupid > > client# cat /mnt1/test1.txt > > something stupid1 > > > > Oh, my God! Both of the exported directories are writable. > > If you export one filesystem ro to an entire subnet, and then also > export the same filesystem rw to a specific machine, the machine > granted r/w permissions can write to that filesystem, yes. That's by > design. Ok, Per-filesystem basis explains everything. Thaks! > If some other machine could write to the filesystem, or if you choose > to export two different filesystems with different permissions, that > would indicate a problem... > > -- > -Chuck > >