Mount SAMBA shares
Introduction
There a several ways of mounting SAMBA shares on a Linux machine. This manual gives an overview.
Prerequisite
It makes things easier if the Linux client is a member of an Active Directory domain. Hence I use Zorin OS, this can easily be achieved with the correct setting during the installation:
If you want to join a Linux computer to an Active directory, please refer to:
Mount SAMBA shares
Manual mount
mount -t cifs -o username=<user>,password=<secret-password> //xigma-prime.simmy.ch/backup /mnt/backup
Permanent mount with fstab
In the fstab, I use the following command:
//xigma-prime.simmy.ch/images /mnt/images cifs credentials=/root/.smbcredentials,uid=1000,forceuid,gid=1000,forcegid 0 0
This will mount the share images to the mountpoint /mnt/images. The credentials are saved in the file .smbcredentials:
username=<username>
password=<password in cleartext>
domain=simmy.ch
Permanent mount with pam_mount
It is more desirable to mount the SAMBA shares when the user logs in, rather during boot.
Installation of the necessary modules
apt install -y libpam-mount keyutils cifs-utils smbclient
Configuration entry in /etc/security/pam_mount.conf.xml
The following lines have to be added to the file after the line <mkmountpoint enable="1" remove="true" />:
<volume
fstype="cifs"
server="xigma-prime.simmy.ch"
path="images"
mountpoint="~/mnt/images"
options="sec=krb5,cruid=%(USERUID),workgroup=SIMMY,vers=3.0" />
Permanent mount with GPO
It is possible to utilize GPOs to mount SAMBA shares on a Linux machine, that is joined to an Active Directory. However, I did not try this possibility.
Temporary mount
It is possible to mount a share with a file manager. This mount will be lost after log off or a reboot.