One owner for a folder

Is it possible to set an owner/set of permissions for a certain
directory on an ext3 partition, and have all subdirs and files keep
those as well?

I have an ext3 partition mounted at /files, and I want all the
files/dirs in /files/shared to have root:user/777 permissions even with
files added by a different user.



uluyol901’s Profile:
View this thread:

777 is a bad idea, at least you could have specified 775.

Files inherit the owner + group of the creating process. If you let the
users write to the filesystem directly, you can’t control the uid/gid.
To be able to control the uid/gid, you need an intermediate process
between the user’s process and the filesystem.

Samba can do this. Besides samba you could try a FUSE filesystem to be
the intermediary.


ken_yap’s Profile:
View this thread:

How would I use FUSE?

-“If it ain’t broke, find something wrong with it”-

some-guy’s Profile:
View this thread:

FUSE is not a single filesystem but rather a framework for creating
filesystems that are materialised by a userspace process. FUSE provides
the kernel hooks, and the libraries, and you have to provide the
process. I don’t know if there is any code ready-made for your
requirements, but what you want is for a userspace process to manage the
directory you want to give access to and then to reexport this as
another filesystem. Have a look at the FUSE documentation.


ken_yap’s Profile:
View this thread:

Another way, which I haven’t looked at in any detail, is to use Posix
ACL inheritance to give the appropriate permissions to objects in the
subtree, bypassing the ownership issue. I’m assuming the reason you want
a common owner is actually to make sure the files are available to all
regardless of who created it. The common Linux filesystems support Posix
ACLs. See the long discussion here. As you can see, the work was done by
a SUSE developer.

‘POSIX Access Control Lists on Linux’

Take note of caveats re copying to other systems and backing up objects
with Posix ACLs.

But ACLs could be quite complex to understand, you should master the
basic Unix permission system first. I can vouch for the complexity,
having tangled with it on OS/X (also a Posix system, as it is based on
BSD) today.


ken_yap’s Profile:
View this thread:

The answer I believe is no.

Users creating files in that directory will create files owned by
themselves, with group access determined by their current primary group.
The permissions on those newly created files will be determined by
their umask.

The only answer that springs to my mind is a cron run script (!)
running every 5 mins that chowns (change user/group) and chmods (change
permissions) (-R [recursive]) all everything below the nominated
directory (/files). No perfect by any means, but might be acceptable to
the users. I would suggest that the script sets the permissions for
owner and group and sets world/other to nothing (chmod 770), and that
you have a specific group that the users can belong to that is just for
this directory (and others like it).

ACLs won’t achieve what you desire either, as the ownership of the
files won’t be changed, they will merely grant access to the files.



KaptRoger’s Profile:
View this thread: