2

is there a way of sharing an ext3/ext4 formatted partition on an external USB drive between different users (uids) on different Linux machines without creating a group for this purpose, setting the group ownership of the partition to this group and adding each respective user to the group on every machine?

This would mean that I need to have root privileges on every machine... which I may not have in some cases.

I'm using the partition to store the code I'm developing on Linux and I would like the option to be safe... if possible.

I could use a vfat partition but then I have no control of the rw rights + I cannot develop directly in the dir: I would always have to tar.gz the directory, extract, work, tar.gz, copy to the external drive... and so on.

Thanks!

tmaric
  • 133
  • 3

2 Answers2

3

The general answer is "no". uid and gid on the filesystem will be as set at the moment of the write and if they don't match on a different machine, then privileges won't match either.

If you do not want to make a small revolution with uids/gids on several machines, you could try using acls to set the desired permissions for all desired users on all machines. I suspect this will use numerical uids internally, so it could happen, that giving access to your account foo on machine A, uid a, will give access to your files to a random guy bar on machine B, uid a. It also seems like it's more hassle than it's worth.

I think that saner approach would be to use tar to migrate your development tree.

I have also had a half-baked idea of carrying around a Subversion repository (with files writable only to root and appropriate access configuration files), and relying on svn server being present on all machines which you are going to use, but I do not think it's excessively sane.

Paweł Brodacki
  • 6,451
  • 19
  • 23
  • Thanks a lot for the answer! So, the right way to go is then to use vfat as the filesystem to get around the permissions, and tar.gz my directories? – tmaric Aug 31 '11 at 07:31
  • vfat/ntfs (because they will have automagically set uid to your own upon file system mount) or extN with a world-writeable directory. It is really ironic, to use Windows file system to move data between Linuxes. – Paweł Brodacki Aug 31 '11 at 08:44
  • "It is really ironic, to use Windows file system to move data between Linuxes." :) It's kind of sad, yes. This is why I wanted to investigate other options in the first place. Thank you very much for your help! – tmaric Aug 31 '11 at 10:35
0

I discover that sys group share id 3 on Debian, Ubuntu, RedHat, Fedora, CentOS, Suse, FreeBSD, OpenBSD, NetBSD, MacOSX, Solaris.

No other groups name share same id. Even root group with id 0 on some systems actually is wheel. And nogroup on Linux is usually 65534 but on BSD is 32766 ((

Set segid bit and ACL (including default) to sys on directory on external storage:

$ sudo chgrp -R sys /mnt/data/dir
$ sudo chgmod -R g+s /mnt/data/dir
$ sudo fsetacl -R -m g:sys:rwx /mnt/data/dir
$ sudo fsetacl -R -d -m g:sys:rwx /mnt/data/dir

After adding user to sys group it able to read and write to /mnt/data/dir on any host. You no longer need sudo privileges each time to grand access.

sys group and setgid bit do job well, but to workaround uname mask you need to use ACL.

This is best what you can do.

UNIX is not designed for personal/home usage. It is corporate/enterprise OS, where is not defined plugging removable media across different hosts ((

See also:

gavenkoa
  • 712
  • 8
  • 12