Ubunutu 18.04 - How to automount a CIFS?

    • OMV 4.x
    • Resolved

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Ubunutu 18.04 - How to automount a CIFS?

      Hi all,

      I have got my OMV up and running and have the SMB/CIFS turned on.
      From Ubuntu files / nautilus I can see the shares and double click to enter the share, enter my credentials and I'm in.

      I want to use Duplicati on my Ubuntu box to send backups each day to the OMV discs so I need the shares to auto mount on login / boot up.
      I have to say I'm totally lost. Is there a newby friendly way to help set this up?
      I keep seeing things like:

      Source Code

      1. sudo mount -t cifs // /media/OMVSmall -o username=user1

      and I get errors like:

      Source Code

      1. mount error(2): No such file or directory
      2. Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

      I really am stumped and hope someone can help out. I can guarantee my password is correct for user1.

      Anything I can research I'd be grateful for the info. Thank you
    • An update to this, I seem to be getting somewhere. I've changed it to:

      Source Code

      1. sudo mount -t cifs //openmediavault.local/nuc-backups /media/OMVSmall -o username=user1
      ... and am now getting this error:

      Source Code

      1. mount error(16): Device or resource busyRefer to the mount.cifs(8) manual page (e.g. man mount.cifs)
      That has to be an improvement I'm guessing but I have no idea how to deal with a busy device :) Does anyone have a suggestion? Thanks a tonne..
    • Why don't you just add it to fstab? It will be mounted on startup. All you need is to make sure you have cifs-tools installed by running:

      Source Code

      1. sudo apt install cifs-tools
      Create you a credential file inside of root's home /root/.smbcredentials and put your credentials (this will ensure the share gets mounted no matter what user is on the computer):

      Source Code

      1. username=user1
      2. password=yourpassword
      3. domain=WORKGROUP (or whatever domain/workgroup you are using)
      Then give the proper permissions to the file like so:

      Source Code

      1. sudo chmod 600 /root/.smbcredentials

      Then add a line to /etc/fstab like so:

      Source Code

      1. //openmediavault.local/nuc-backups /media/OMVSmall cifs credentials=/root/.smbcredentials,uid=user1,noperm,rw 0 0
      You can then either mount the share by issuing sudo mount -a or by rebooting. I would recommend, though, mounting it under /mnt instead of /media because Ubuntu uses that directory for automatic media mounting and might cause you some issues.

      The post was edited 1 time, last by bkraul: Missing information. ().

    • This is an excellent reply. I've gone through those steps and I THINK it's working. I particularly like the credentials file being kept separately. Very nice.
      I'll give it a thorough run down and report back. Just wanted to say thanks. This should be pinned or something for beginners.