From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id C5275138247 for ; Fri, 3 Jan 2014 06:46:25 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4A64EE0AA1; Fri, 3 Jan 2014 06:46:20 +0000 (UTC) Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 19E64E0A7F for ; Fri, 3 Jan 2014 06:46:18 +0000 (UTC) Received: by mail-wi0-f170.google.com with SMTP id hq4so160463wib.5 for ; Thu, 02 Jan 2014 22:46:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=OHpQ4kCaszvY9WZJv/bp1ZgNZTc5f5Eusn4DE+w7+n0=; b=FfSHcR/4VL15Kn1yV3r+WG8RyRSI3nvvMzLMC2ZKzlKxalbqj1FuqsM7DoVeC/xnfl uyv048derpmzx/4RZ9yMVZybcI7cTf9kPrhs7bOlqFFvNmyjTXE8nxu/PqpkpYiRBvF2 rRO0icxLnOdAVgzd16AoHBO4Z9lGvwWv8VT90wyqaBfSNb4GLWTOBYtxqzR6JQR0F5cf VXQbnLdsUDU1qT+9z3Zx0y8288BqgntwTFhoHkv50iV9dOAuIB5MBuDdl9+X+EXjdbbE iRSKICOkdaOypfkrQVMBzJDq1p6NXx3vALq73XRbVxhcqj5MKTaD/MrD87WksxCfIQB/ DVtQ== X-Received: by 10.194.237.99 with SMTP id vb3mr60316648wjc.28.1388731577812; Thu, 02 Jan 2014 22:46:17 -0800 (PST) Received: from [172.20.0.41] (196-210-126-67.dynamic.isadsl.co.za. [196.210.126.67]) by mx.google.com with ESMTPSA id j3sm981453wiy.3.2014.01.02.22.46.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 Jan 2014 22:46:17 -0800 (PST) Message-ID: <52C65C99.5080208@gmail.com> Date: Fri, 03 Jan 2014 08:45:45 +0200 From: Alan McKinnon User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Preparing a shared USB stick References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Archives-Salt: e57bdf2e-40c1-4e89-b7a6-6cf9eaaa729d X-Archives-Hash: 1ba58e5a3e6521141f2605adc9527f71 On 03/01/2014 01:02, Chris Stankevitz wrote: > Hello, > > Please consider a USB "stick" that is unformatted but is to be used by > multiple people/machines. Ideally your instructions will work for all > people/os/WM, but if necessary please assume that everyone is running > gnome under linux > > 1. How should I prepare this device so that it can be plugged into any > machine and will be writable by anyone? I suspect the answer will > involve words like fdisk, mkfs.xxx, mkdir/mount, chmod/chown. I'm > most interested in the chmod/chown part. > > 2. How can I prepare the device so that files/directories added by > people in the future will continue to be writable by anyone? > > 3. How can I ensure that all files will appear to have the same owner; > or, if this is not important, can you explain why it should not be a > problem. > > And of course if you can refer me to a document that explains this I'm > happy to read it. Just go with FAT and automounting by the DE. It's a removeable stick, the user has it in their hands so the entire concept of security is instantly null and void right there. Forget all about /etc/fstab, mount options user and user, mount options mask, fmask and dmask. Instead, put each user that needs to use it in the plugdev or disk group as appropriate and let the DE do the heavy lifting; and remove from fstab anything and everything related to removeable USB sticks. If you let the DE do the automounting for you, you get a filemanager window (dolphin, nautilus and friends) and the contents of the stick are visible right there, ready to use, all set up correctly. DO NOT USE NTFS ON A STICK. The driver has been reverse-engineered and there is no guarantee that writing to it under anything that isn't Windows will work. FAT is a published standard and we all know how it works. tl;dr You don't need chown/chmod at all. FAT has no concept of owner and permissions, so the kernel fudges these. Basically, when mounting the stick it pretends every file on it is owned by the user that mounted it and everything has permissions 777, regardless of who plugged it in. Considering the nature of a USB stick, this is almost always what you want. Don't bother partitioning the stick either, Windows treats them as one huge floppy and so should you. You will normally only ever have one partition anyway, so why have any at all? The code supports this. To format it in Linux, do this: mkfs.vfat -I /dev/ Stay far away from /etc/fstab. That file was designed ages ago for permanent mounts, like / and /usr and /home. To work properly, you must be able to uniquely identify any device and never get it confused. You just can't do that with sticks, not even with fs labels, and you certainly don't want to hand-edit UUIDs. And you still have to deal with users having different uids on each machine. Ugh. The DE just makes all this hassle go away. If your sticks are larger than 32G, you might want to use exFAT instead of FAT - think of it as FAT that can deal with huge disks properly: emerge sys-fs/fuse-exfat you will need FUSE support in your kernel for this. -- Alan McKinnon alan.mckinnon@gmail.com