[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Having filesystems mounted with the user option be owned by the user that mounts them?



	Hi.

On Fri, Sep 04, 2020 at 01:37:07PM -0400, rhkramer@gmail.com wrote:
> I'm still working on my backup system, and setting up mount points.
> 
> I was hoping that if I used "user" (or "users") in the mount command (or in 
> /etc/fstab) that the mounted filesystem would be owned by the user that mounted 
> it.  That doesn't (seem to) work.

Because it should not work the way you seem to expect it to. Both "user"
and "users" mount options have completely different semantics. Quoting
mount(8):

user   Allow an ordinary user to mount the filesystem.
users  Allow any user to mount and to unmount the filesystem, even when
		some other ordinary user mounted it.


> I could do things like give write permission to everyone,

So that one user could overwrite a backup of another user.

> or set up a group with the users that I might want to be able to write to the backup,

See above.

> or set up a user for the specific purpose of doing backups,

grep x:34 /etc/passwd
It's there already.

> or do the backups as root,

Nothing wrong with this approach, see below.


> but none of those seem to be appropriate in one way or another.  

See below.


> Is there a simple way to have the mounted filesystem be owned by the user that 
> mounts it?

In a general case? No.
If your plan is to use a filesystem that does not provide POSIX
permissions (i.e. FAT, NTFS, ISO9660 without extensions) - then it's
possible, and you generally need "uid" and "gid" mount options.
Otherwise your best bet is recursive chown or ACLs.


> (I know something about the -o uid and -o gid options, but (1) that would only 
> work for one specific uid, and (2), iiuc, that works only for filesystems that 
> don't use the Unix permissions (e.g., fat32, ntfs, ...).)

It seems to me that you're trying to solve this problem a wrong way.

A question one - why would you need a *user* to perform a backup?
User tend to disregard the importance of backups, tend to forget about
doing backups, and worse - tend to destroy a perfectly valid backup just
before it's actually needed.

Would not it be better to do a backup of users' files in a centralized
way on an admin (i.e. - you) controlled schedule?


A question two - "apt search backup" shows me at least half-dozen ready
to use (and free software) backup solution. Why bother implementing your
own?

Reco


Reply to: