Page 3 of 3 FirstFirst 123
Results 21 to 27 of 27

Thread: Mount Samba shares automatically after establishing Wifi

  1. #21
    Join Date
    Feb 2010
    Location
    Europe
    Beans
    16
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Mount Samba shares automatically after establishing Wifi

    It's a NAS device and a manual mount works fine even without reduced security (sec=ntlm) or an earlier smb dialect (vers=1.0).

    But why does it work manually and not automatically?

  2. #22
    Join Date
    Dec 2009
    Beans
    6,776

    Re: Mount Samba shares automatically after establishing Wifi

    The only difference between the manual cifs mount I suggested above and your autofs mount is the option nounix.
    ata -fstype=cifs,rw,credentials=/home/ata/.smbcredentials,file_mode=0660,dir_mode=0770,uid=1000,nounix ://192.168.178.250/ata



  3. #23
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Mount Samba shares automatically after establishing Wifi

    Did you restart the autofs service? That is required with every config change. Also, the mount will only show up when requested. You need to ask for /nas/ata/ to get it mounted. Any request should work, open a terminal and do an ls /nas/ata/. That's one example. I don't know how to make it work using a file browser, since the 'ata' directory won't show up until requested.

    There is an option to make available mounts "ghost" before they are mounted. This is specific to autofs.master and the line. --ghost is the option.
    Code:
    /nas   /etc/auto.cifs-shares --timeout=60 --ghost
    This should make using a file browser work, since the empty, unmounted, 'ata' will be there.

    And don't forget to restart the autofs service after any config changes.
    Last edited by TheFu; September 30th, 2018 at 04:39 PM.

  4. #24
    Join Date
    Feb 2010
    Location
    Europe
    Beans
    16
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Mount Samba shares automatically after establishing Wifi

    Quote Originally Posted by TheFu View Post
    Did you restart the autofs service? That is required with every config change.
    Yes.


    Quote Originally Posted by TheFu View Post
    Also, the mount will only show up when requested. You need to ask for /nas/ata/ to get it mounted. Any request should work, open a terminal and do an ls /nas/ata/. That's one example. I don't know how to make it work using a file browser, since the 'ata' directory won't show up until requested.
    ls /nas/ata/ does work, but I want to use this share with GUI applications.


    Quote Originally Posted by TheFu View Post
    There is an option to make available mounts "ghost" before they are mounted. This is specific to autofs.master and the line. --ghost is the option.
    Code:
    /nas   /etc/auto.cifs-shares --timeout=60 --ghost
    This should make using a file browser work, since the empty, unmounted, 'ata' will be there.
    Great! The parameter --timeout=60 --ghost solved the problem.

    I've tested it with different GUI applications each after a reboot.


    Quote Originally Posted by TheFu View Post
    And don't forget to restart the autofs service after any config changes.
    I will never forget it (again).



    Summary


    1. I've created the new directory /nas on my machine.

    2. Then I've created the new credentials file /home/ata/.smbcredentials:
    Code:
    username=<my_username_on_NAS>
    password=<my_password_on_NAS>
    3. Then I added the following line to /etc/auto.master:
    Code:
    /nas   /etc/auto.cifs-shares --timeout=60 --ghost
    4. Then I changed /etc/auto.cifs-shares to this:
    Code:
    ata -fstype=cifs,rw,credentials=/home/ata/.smbcredentials,file_mode=0660,dir_mode=0770,uid=1000 ://192.168.178.250/ata
    Last edited by Atalanttore; October 3rd, 2018 at 04:40 PM. Reason: Simplificated my summary

  5. #25
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Mount Samba shares automatically after establishing Wifi

    Very nice summary! Please mark the thread as SOLVED - thread tools, near the top.

    I will never forget it (again).
    Yes, you will. We all do. And in another 20 yrs, it will still happen even when you know better.

    BTW, I really like your /nas mount name.

  6. #26
    Join Date
    Feb 2010
    Location
    Europe
    Beans
    16
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Mount Samba shares automatically after establishing Wifi

    I did the summary for other users, because as mentioned in comment #13 before, autofs is not intuitive at all, but fortunately you only have to do the setup once.

    I called the mount point /nas, because my file server is a NAS.

  7. #27
    Join Date
    Feb 2010
    Location
    Europe
    Beans
    16
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Mount two Samba shares automatically after establishing Wifi

    Today, I set up the same Samba mount point like described here on another Notebook running Ubuntu 18.04 and add a second mount point for another directory on my NAS.

    For the second mount point I've added a second line to /etc/auto.cifs-shares:
    Code:
    ata -fstype=cifs,rw,credentials=/home/ata/.smbcredentials,file_mode=0660,dir_mode=0770,uid=1000 ://192.168.178.250/ata
    public -fstype=cifs,rw,credentials=/home/ata/.smbcredentials,file_mode=0660,dir_mode=0770,uid=1000 ://192.168.178.250/public
    Unfortunately it doesn't work like this. No share is mounted at all.

Page 3 of 3 FirstFirst 123

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
  •