How to mount SAMBA/CIFS share storage on Debian based Linux Distros
Install CIFS
If CIFS is not installed yet, install it now. In Debian-based distributions, the command is provided via the package cifs-utils:
apt-get install cifs-utils
You can mount the Storage Box on any directory. However, you should mount your Storage Box on an empty directory. If you mount your Storage Box on a directory with data, it is not possible to access this data until the Storage Box is unmounted again. To avoid issues like this, you can just create a new direcotry, for example in /mnt:
mkdir -p /mnt/my-storage-box
Manually mount the Storage Box directory
For this session, you will have to mount the file system manually. If you add the file system and its mount point to the fstab file, the system will automatically mount your file system at every reboot. This step is optional and will be explained below.
Use this command to mount the file system of the Storage Box on the new directory:
Replace
mount.cifs -o seal,user=<username>,pass=<password> //<username>.your-storagebox.de /mnt/my-storage-box
To encrypt a SAMBA connection, you need the seal option. Note that this feature is only available in newer Linux versions (e.g. starting with Ubuntu 18.04).
Test access
Navigate to the directory on which you just mounted the Storage Box. The directory should now contain all data of your Storage Box.
Add an entry in fstab
The fstab file contains file systems and all related mounting options. All file systems that are listed in /etc/fstab are automatically mounted at a reboot.
Edit /etc/fstab and add the following line:
#Replace the address and /mnt/my-storage-box with your own information.
//<username>.your-storagebox.de/backup /mnt/my-storage-box cifs iocharset=utf8,rw,seal,credentials=/etc/backup-credentials.txt,uid=<System User>,gid=<System Group>,file_mode=0660,dir_mode=0770 0 0
To encrypt a SAMBA connection, you need the seal option. Note that this feature is only available in newer Linux versions (e.g. starting with Ubuntu 18.04).
Add an entry in /etc/backup-credentials.txt
To automatically mount the Storage Box directory at reboot, the system needs your access details to the Storage Box. Add this line in /etc/backup-credentials.txt:
Replace username and password with your own information.
username=<username>
password=<password>
The file should have the following permissions:
chmod 0660 /etc/backup-credentials.txt
If you get mount error 79 CIFS mount error: iocharset utf8 not found
, then just install nls_utf8.ko with
apt install linux-modules-extra-$(uname -r)-generic
reboot
And you are good to go!