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

Thread: Local network sharing config issue

  1. #11
    Join Date
    Dec 2009
    Beans
    6,577

    Re: Local network sharing config issue

    Are all these local server users creating shares from their individual home folders?

    Is there any way you can confine them to create a subfolder then share that subfolder within one centralized parent folder?

  2. #12
    Join Date
    Sep 2013
    Beans
    29

    Re: Local network sharing config issue

    Great thanks for all your help. I have worked around it but internally mounting the shares on the server via samba and then linking the home directories to that point instead. So as long as they don't access the disk mount directly we should be ok?

  3. #13
    Join Date
    Dec 2009
    Beans
    6,577

    Re: Local network sharing config issue

    Not sure I understand that but ...........

    I was going to suggest something a bit out of the box.

  4. #14
    Join Date
    Sep 2013
    Beans
    29

    Re: Local network sharing config issue

    So I have the local disk mounted as /media/data. I have then created samba shares for each shared directory in /media/shares and then symbolic links from each users home drive to the /media/shares directories.

    e.g. /home/lee/Documents --- (sym link) ---- > /media/shares/Documents ---- (samba mount) ----> /media/data/Documents.

    The idea being that as long as they don't put anything directly in /media/data/Documents everything locally on the server will also be stored via samba and therefore should not have any perm issues.

    I have just discovered an issue though. When I reboot the server, it doesn't auto mount the samba shares and I have to run mount -a to fix it. Any ideas?

    Also... if you have an "out of the box" alternative, happy to try that instead.

    Thanks
    Lee.

  5. #15
    Join Date
    Dec 2009
    Beans
    6,577

    Re: Local network sharing config issue

    I'm not sure I understood that either ....... So you are creating a cifs mount on the client of the same server that has the shares? Um ... I guess that would work. It's may be more out of the box than mine.

    As far as not automounting at boot .... yep cifs will do that ... fstab is being executed before the network stack is fully operational so it fails. One way around this is to use x-systemd.automount but you will have to change the mount point of the cifs mount from under /media to somewhere else.

    If you post one of your cifs mount expressions I may be able to assist.

    My "out of the box" may not fit your use case but here it is:

    NOTE: BINDFS allows you to mount an object someplace else with a "view" defining permissions that are different from the original and are immutable. Sorta kinda the way Linux mounts an NTFS partition with a "view" showing Linux ownership and permissions when in fact in has none.

    [1] Create a "hidden" folder at say /.MasterShare
    Code:
    sudo mkdir /.MasterShare
    [2] Create a non-hidden folder at /MasterShare
    Code:
    sudo mkdir /MasterShare
    The permissions of those folders don't matter. Bindfs will change them in its "view"

    [3] Install bindfs:
    Code:
    sudo apt install bindfs
    [4] Edit /etc/fstab and have /.MasterShare mount to /MasterShare using bindfs and define the needed permissions:
    Code:
    /.MasterShare /MasterShare fuse.bindfs perms=0666:+X,x-gvfs-hide,nonempty    0    0
    [5] Make systemd happy:
    Code:
    sudo systemctl daemon-reload
    [6] Then issue the following to do the mounting:
    Code:
    sudo mount -a
    [7] The only change you need to make to smb.conf from the default setup is to add just one line under workgroup = workgroup line to eliminate having samba set the execute bit on saved files:
    Code:
    map archive = no
    [8] Then restart smbd
    Code:
    sudo service smbd restart
    So the user would then create a subfolder under /MasterShare and use Files to share that subfolder.

    Any file added locally or across the network to that subfolder / share will save with all manner of user and group but every file will be 666 and every folder will be 777.
    Last edited by Morbius1; February 14th, 2021 at 03:03 PM.

  6. #16
    Join Date
    Sep 2013
    Beans
    29

    Re: Local network sharing config issue

    Thanks Morbius1 much appreciated. Yes you are correct, I am creating a cifs mount on the same server that has the shares. The cifs line in fstab is

    //server/Documents /media/share/Documents cifs guest,uid=user,gid=group,iocharset=utf8,file_mode= 0777,dir_mode=0777,noperm 0 0
    To be honest, I am not familiar with bindfs so if I could get this working I would prefer it as at least I understand it

  7. #17
    Join Date
    Dec 2009
    Beans
    6,577

    Re: Local network sharing config issue

    //server/Documents /media/share/Documents cifs guest,uid=user,gid=group,iocharset=utf8,file_mode= 0777,dir_mode=0777,noperm 0 0


    Regrettably you will have to change that mount point to be something like /mnt/share/Documents. automounters and things under /media and $HOME don't play well together.

    Then you need to add two more options to the statement: noauto,x-systemd.automount
    Code:
    //server/Documents  /mnt/share/Documents  cifs   guest,uid=user,gid=group,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm,noauto,x-systemd.automount 0 0
    Then you have to do the systemd 2-step:
    Code:
    sudo systemctl daemon-reload
    sudo systemctl restart remote-fs.target
    This works by mounting on request. It will not automatically mount at boot. But anything will initiate the mount: any user by accessing the mount point in the file manager, through the terminal, by any application ... It's pretty seamless.

  8. #18
    Join Date
    Sep 2013
    Beans
    29

    Re: Local network sharing config issue

    you star!!! Thanks it works a treat. On the other PC I mount the remote directories in /media and then each user I have symbolic links from their home directories to each of the shared directories. Trouble is that if the mounts were ok and the server goes down, an 'ls' in their home directory hangs. Would adding the extra options to mount on demand help this too?

  9. #19
    Join Date
    Dec 2009
    Beans
    6,577

    Re: Local network sharing config issue

    The "noauto,x-systemd.automount" will fix the fstab is executed before the network is up problem but it doesn't fix your new issue. Once it is mounted it stays mounted. If your server goes away it can't repair itself.

    There is another systemd fstab option which some folks use for your new issue:
    Code:
    x-systemd.idle-timeout=30
    When you are done accessing the server systemd starts a clock and if you haven't used the share in 30 seconds ( you can set this to whatever makes sense ) it auto-unmounts. Setting that time interval takes some experimentation. You are making a bet that the server will not go down when you are actively accessing it.


    Don't forget the systemd commands:
    Code:
    sudo systemctl daemon-reload
    sudo systemctl restart remote-fs.target

  10. #20
    Join Date
    Sep 2013
    Beans
    29

    Re: Local network sharing config issue

    great thanks. Is it just 'ls' that will fail or will any file access hang? I am building this system for someone else but I don't recall this hanging being an issue on my system (nfs rather than cifs) but there again the server is always on so maybe never really got into this situation to notice

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
  •