From: Alan McKinnon <alan.mckinnon@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Preparing a shared USB stick
Date: Fri, 03 Jan 2014 08:45:45 +0200 [thread overview]
Message-ID: <52C65C99.5080208@gmail.com> (raw)
In-Reply-To: <CAPi0psvFOhdJ0WokoN6F+1TrPcjEMoDVCZqzTuTWSnxkZyP8hQ@mail.gmail.com>
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/<whatever>
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
next prev parent reply other threads:[~2014-01-03 6:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-02 23:02 [gentoo-user] Preparing a shared USB stick Chris Stankevitz
2014-01-02 23:44 ` Mateusz Kowalczyk
2014-01-03 2:31 ` Francisco Ares
2014-01-03 9:16 ` Neil Bothwick
2014-01-04 23:32 ` Chris Stankevitz
2014-01-03 6:45 ` Alan McKinnon [this message]
2014-01-03 18:47 ` [gentoo-user] " James
2014-01-04 23:31 ` [gentoo-user] " Chris Stankevitz
2014-01-04 23:44 ` Alan McKinnon
2014-01-05 0:42 ` [gentoo-user] " walt
2014-01-05 1:21 ` Alan McKinnon
2014-01-05 21:26 ` walt
2014-01-05 21:55 ` Alan McKinnon
2014-01-05 21:50 ` walt
2014-01-05 21:59 ` Alan McKinnon
2014-01-05 5:15 ` [gentoo-user] " Chris Stankevitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52C65C99.5080208@gmail.com \
--to=alan.mckinnon@gmail.com \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox