Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Sharing

  1. #11
    Join Date
    Dec 2009
    Beans
    5,370

    Re: Sharing

    Here's a mini HowTo on the use of Bindfs is you are interested:

    Try the following experiment to see how this works:
    [1] Install bindfs
    Code:
    sudo apt-get install bindfs
    [2] Create a couple of Test directories

    *** Create a hidden directory:
    Code:
    sudo mkdir /.Test
    *** And an non-hidden directory:
    Code:
    sudo mkdir /Test
    *** Use bindfs to mount one to the other:
    Code:
    sudo bindfs -o perms=0660:+X,force-group=plugdev /.Test /Test
    Now copy a file to /Test. It's permissions will be 660 and it's group will be plugdev. To undo the mount:
    Code:
    sudo umount /Test
    Note: The only reason I chose plugdev as the group is that it's already available.

    To make this permanent you have a couple of options:

    *** Add the line without sudo to rc.local
    *** Or, Add a line to /etc/fstab with a different syntax:
    Code:
    bindfs#/.Test    /Test    fuse    perms=0660:+X,force-group=plugdev    0    0
    *** Or, The way I do this is with an Upstart Job which is in my opinion the most reliable and safest way to do these sorts of things:

    Create an upstart file:
    Code:
    gksu gedit /etc/init/bindfs-mounts.conf
    With this content:
    Code:
    # Remount Directories with Bindfs
    #
    description "Bindfs Remounts"
    
    start on stopped mountall
    
    script
    bindfs -o perms=0660:+X,force-group=plugdev /.Test /Test
    end script
    Once set by bindfs all files and folders created in, copied to, or moved to that folder will have group ownership of plugdev and folder/file permissions of 770/660 except for files that are executable - they will be 770. At this point no other process - not umask, not Samba, not even root - can change permissions on an individual file.
    Last edited by Morbius1; November 13th, 2013 at 02:46 PM.

  2. #12
    Join Date
    Mar 2010
    Location
    Metro-ATL
    Beans
    Hidden!
    Distro
    Lubuntu 12.04 Precise Pangolin

    Re: Sharing

    Quote Originally Posted by Morbius1 View Post
    Here's a mini HowTo on the use of Bindfs is you are interested:
    That is some cool stuff for admins! Guess we know how mount.ntfs works now (which drives me nuts) ... it uses bindfs.
    Still, I can see uses and simplified methods from the way I've been doing things in some places.

    Plus it will be lots-o-fun to screw with development teams. Never let them create an executable file (ok, just not set the +x perms) on their file system - I can hear the laughing now! Wonder how much time they will waste on this? It would be cruel.

  3. #13
    Join Date
    Dec 2009
    Beans
    5,370

    Re: Sharing

    That's a big "X" in the bindfs statement. Files that are executable will remain so. It's the same as doing a:
    Code:
    chmod -R a+rwX,o-w /Test
    I'll edit my previous post to make that clear.

  4. #14
    Join Date
    Mar 2010
    Location
    Metro-ATL
    Beans
    Hidden!
    Distro
    Lubuntu 12.04 Precise Pangolin

    Re: Sharing

    Quote Originally Posted by Morbius1 View Post
    That's a big "X" in the bindfs statement. Files that are executable will remain so. It's the same as doing a:
    Code:
    chmod -R a+rwX,o-w /Test
    I'll edit my previous post to make that clear.
    Saw that ... it was clear to me, but I was thinking of a different use-case: "Screw with devs" was the purpose. Might be handy on a data file system too - you know, a place for documents and media files only.

    Some day I'll grow up ... maybe around age 60? Probably not.

  5. #15
    Join Date
    Dec 2009
    Beans
    5,370

    Re: Sharing

    You know, the subject of the execute bit and bindfs is somewhat confusing especially if you've never used it before so it might be worth explaining a bit more.

    Bindfs creates a "view" of a folder whose attributes are defined by the bindfs statement. It has no affect on the folder that it is bound to. So using my example above if I create a new file in /Test in 13.10 it will save with permissions of 644 in /.Test but it will appear as 660 in /Test because bindfs makes it so.

    Similarly, if I set the execute bit on that file in /Test it will change it to executable in /.Test but this time also in /Test since the bindfs statement makes it so with the "perms=0660:+X" statement.

    So setting the execute bit in bindfs can be thought of as working as designed because of the way I crafted the bindfs statement or the exception to the "no other process can change permissions" rule.

  6. #16
    Join Date
    Nov 2013
    Beans
    1

    Re: Sharing

    I have a home network where my wife and I are members of the network. We each have our own desktops and on her machine, I have set her up as owner=mary and group=family. On my machine owner=peter, group=family. I created the family group and added mary and peter as members. Next I set umask 007 (or 0007) in the files: ~/.profile ~/.bashrc /etc/profile /etc/login.defs Both my wife and I backup our files using rsync to a backup drive attached to my machine and formatted EXT4 and is shared. The problem I am having is some files end up on that external drive with the original default permissions of rw-r--r-- instead of rw-rw---- and in the case of folders some end up with the original default permissions of rwxr-xr-x instead of rwxrwx--- In addition, some of my files end up as petereter instead of peter:family and her files end up as mary:mary instead of mary:family I am forever running chown and chmod so either of us can access the others files. when I type umask in a CLI I get 0022. I am not sure why this is happening. My research on umask has not brought up any areas that I need to adjust. my latest effort is to add sudo chfn -o "umask=007" peter to my /etc/passwd file and sudo chfn -o "umask=007" mary to my wife's. Not sure if this is the right thing to do as the /etc/passwd file contains lines that are not like the commands I added. Any ideas? Thanks, Peter

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

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