Sharing a disk between *nix systems : who owns the files ?

Hello,

I recently bought an USB drive, and wanting to share it between my Linux laptop and my BSD desktop, I formatted it as EXT2. However, on my desktop I have userid 1001, on my laptop I have userid 1000. My files that belonged to fred:fred now belong to john:tex ! (Don't ask me why TeX has GID 1001 on Linux. Or why it need a group of its own. That's another issue.)

I fixed it temporarily with a recursive chown, but how can I do on the long run ? I can tell mount to allow user fred to mount the disk with label X, but I didn't see how to tell it that on this disk, userid 1001 is actually fred. Any idea ? Web searches for ownership/permission issue with moveable media only turn up thing about FAT formatted drives, it seems.
 
Fred, AFAIK ext2 is going to honor the UIDs/GIDs; I don't know of any clever mount tricks to get around that. So the answer here is to get them in sync between the two OSes. :)
 
AFAIK there's no real solution to this problem with regard to unix file systems. In this respect NTFS formatted removable media suffers the same problem (FAT doesn't store ownership/permissions).

On *nix it's slightly "easier" to solve compared to Windows and NTFS. On *nix you can pick a UID/GID so all you have to do is make sure you always have the same UID/GID. On Windows this is impossible because you have no control over the SID.
 
The solution is centralized servers for authentication (for e.g. OpenLDAP). Almost all UNIX like operating system can authenticate against LDAP. Also, roaming directory and profile from file server can keep everything synced for all desktops. Both KDE and Gnome can be configured to keep same profiles (including wallpapers, desktops, folders and so on) on all desktop systems. This is good for university or corporate office. But for home it may not be possible or just overkeep. Or you can use vmware server to deploy everything and enjoy all the benefits of central servers :e
 
Hum. The LDAP authentification may be an interesting project, but it is slightly overkill :).

I guess what I can do is create a group that isn't used by either OS (in the 2000s range ?), put my user in it, then use ACLs in order to have new files being created with this group. I saw that FreeBSD has ACL for UFS, Linux has them for ext, I'll see if they work with FreeBSD in ext2.
 
@Fred: If it's an option, how about just formatting your usb drive as msdosfs (from FreeBSD) or as vfat (from Linux)?

Your idea seems OK, but also sounds like some ongoing effort / maintenance / troubleshooting to me.
 
The only problem with FAT is that even FAT32 is limited to files no larger than 4 GB. I wish we had a simple, permission-less file system that had liberal limits and was open.
 
I don't know what its like on BSD, but I've often had this problem on Linux. The family machines can be running anything up to 6 accounts. The problem arises with 'nux when one plugs the usb drive in before switching accounts (even with fat 32). Files are automatically assigned to the first account they are plugged into. Two easy solutions:

1. copy the files off, reassign them, reformat the drive, put the files back, unplug the drive then replug in fred:fred and be sure never to run the drive while john:tex is open.

2. if there is no overriding reason to keep the accounts safe from each other, put them in a shared group and share read/write permissions between the two accounts. If there are overriding reasons, give john:tex a new account with a different name.

I've used both work-arounds, they're clumsy but they do the job.
 
Back
Top