From owner-freebsd-questions Mon Sep 30 2:52:40 2002 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 0A29C37B401; Mon, 30 Sep 2002 02:52:38 -0700 (PDT) Received: from smtp.infracaninophile.co.uk (happy-idiot-talk.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id DAC2043E4A; Mon, 30 Sep 2002 02:52:36 -0700 (PDT) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost.infracaninophile.co.uk [IPv6:::1]) by smtp.infracaninophile.co.uk (8.12.6/8.12.6) with ESMTP id g8U9qZOL052173; Mon, 30 Sep 2002 10:52:35 +0100 (BST) (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost) by happy-idiot-talk.infracaninophile.co.uk (8.12.6/8.12.6/Submit) id g8U9qUDS052172; Mon, 30 Sep 2002 10:52:30 +0100 (BST) Date: Mon, 30 Sep 2002 10:52:30 +0100 From: Matthew Seaman To: Giorgos Keramidas Cc: "Marc G. Fournier" , freebsd-questions@FreeBSD.ORG Subject: Re: Per directory disk quotas ... Message-ID: <20020930095230.GB51277@happy-idiot-talk.infracaninophi> Mail-Followup-To: Matthew Seaman , Giorgos Keramidas , "Marc G. Fournier" , freebsd-questions@FreeBSD.ORG References: <20020929231438.W69855-100000@hub.org> <002101c26838$78ec3b00$5bd7cdd4@LocalHost> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <002101c26838$78ec3b00$5bd7cdd4@LocalHost> User-Agent: Mutt/1.5.1i X-Spam-Status: No, hits=-14.7 required=5.0 tests=IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_02_03, USER_AGENT,USER_AGENT_MUTT version=2.41 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, Sep 30, 2002 at 07:18:29AM +0300, Giorgos Keramidas wrote: > ----- Original Message ----- > From: "Marc G. Fournier" > To: > Sent: Monday, September 30, 2002 5:25 AM > Subject: Per directory disk quotas ... > > > : does anyone know of some way of setting a disk quota > : onto a directory? so that a directory, and all > : sub-directories/files below it cannot consume more > : then x amount of space? > > Setting permissions that alloww only a certain group of users > to write things in that directory, and then using edquota to > limit the quota of that group under the directory. Let's say, > for example, that you want to limit /mnt/foobar to 100 kbytes. > Let's also assume that /mnt/foobar is under an /mnt mountpoint. > > Create a new group called "foobar". The name of the group > doesn't need be the same. It might helps remembering what > this group was created for later on though. > > # groupadd foobar > > Make root:foobar the owner of /mnt/foobar. > > # chown -R root:foobar /mnt/foobar > > Add write permission to /mnt/foobar for the group: > > # chmod 0775 /mnt/foobar > > Edit the "group quota" of foobar: > > # edquota -g foobar -f /mnt > > Done. Don't let "*:foobar" have write access anywhere else > under /mnt and you're set to go. The users that belong to > the "foobar" group will be limited under /mnt/foobar. Quotas would work, but requires some administrative oversight by the admin over the users to make sure that files with the group ownership don't get created outside the specific tree or that files belonging to other groups don't appear inside the tree. An alternative approach would be to use vnconfig(8) to create pseudo disks of the right size, which you can then put a filesystem onto and mount in the correct place. I've seen reports that this technique works very well to limit the amount of space a jail(8) can use even if the jail's owner has full control over the password file in it. Cheers, Matthew -- Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message