1

I have a Rasberry Pi 3B+ running Ubuntu server 20.04.1. I am trying to load shares from my NAS at startup to use with minimserver music server library. After having done some web searching I have succesfully done this with the line below typed into the terminal at ubuntu@ubuntu.

sudo mount -t cifs //192.168.0.70/Playlists /home/ubuntu/Music/Playlists -o username=admin,password=mypassword,uid=1000,vers=1.0,sec=ntlm

However when I try to get this to load at startup by pasting it into etc/fstab using nano it doesn't load the share on startup and I am trying to work out how I can fix this.

I am pretty new to this and mostly understand the above line. Does the line need to be amended somehow to work in etc/fstab? Not completely sure what -t and -o do though. I think first is to do with the version of smb that is needed and second is something to do with security, so thanks for any help anyone can give me.

KazikM
  • 255
MDF
  • 11

2 Answers2

1

The fstab entry format is slightly different from the command you run in the terminal. It should look something like this:

//192.168.0.70/Playlists /home/ubuntu/Music/Playlists username=admin,password=mypassword,_netdev,auto 0 0

It is ,however, possible and encouraged to save your password and username in a file on your system like so:

username=value
password=value

and specify the path to this file in the options part after credentials= instead of username=admin,password=mypassword

Please read here and here for the meaning and usage cases of other options.

Raffa
  • 32,237
0

I had the same problem with my Diskstation-1 and Pi 18.04.5. :

  1. I could never get the mount to work like you're doing from cli with -o username-admin etc.
  2. I couldn't get the fstab thingy to work for startup so I wrote a script (at end of post) and invoke it with a crontab entry.
  3. I could mount from command line using this command which used a credentials file: sudo mount -t cifs -o credentials=/usr/local/etc/.cifscredentials-backup,vers=2.0 //diskstation-1/backup /backup/
  4. The .cifscredentials-backup file contained the following entries:
username=backup-admin 
password=backup-admin-password 
domain=diskstation-1

This is an account that I setup on my Synology NAS for backups that has permission to r/w the //diskstation-1/backup share.

This is the script:

#!/bin/sh
#
# $Id: mountcifs_backup.sh,v 1.2 2019/06/11 22:25:36 pacal683 Exp $
#
umask=133
PATH=/usr/sbin:/bin:/usr/bin
HOSTNAMESHORT=`hostname -s`
os=`uname`
# The touchfile is created by hand from cli after manually mounting the share
TOUCHFILE=/backup/.$HOSTNAMESHORT
if [ -f $TOUCHFILE ]; then
        echo "CIFS mounted OK"
else
        if [ ! -f $TOUCHFILE ]; then
                cmd=`sudo umount /backup > /dev/null`
                eval $cmd
                cmd=`sudo mount -t cifs -o credentials=/usr/local/etc/.cifscredentials-backup,vers=2.0 //diskstation-1/backup/home.net /backup/`
                eval $cmd
        fi
        if [ -f $TOUCHFILE ]; then
                echo "CIFS mounted OK"
        else
                echo "Mounting CIFS failed: $cmd"
        fi
fi
umask 022
##
# $Log: mountcifs_backup.sh,v $
# Revision 1.2  2019/06/11 22:25:36  pacal683
# redid logic flow for checking if already mounted
# had problem with while event loop previously used
#
# Revision 1.1  2019/06/11 22:16:19  pacal683
# Initial revision
#
pacal683
  • 26
  • 5