Results 1 to 6 of 6

Thread: One owner for a folder

  1. #1
    uluyol901 NNTP User

    Default 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?

    Example:
    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.

    Thanks.

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: One owner for a folder

    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.

  3. #3

    Default Re: One owner for a folder

    How would I use FUSE?
    "If it ain't broke, find something wrong with it"

  4. #4
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: One owner for a folder

    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.

  5. #5
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: One owner for a folder

    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.

  6. #6
    Join Date
    Jun 2008
    Location
    U.K.
    Posts
    119

    Default Re: One owner for a folder

    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.

    Cheers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •