Here’s a brief guide on how to mount a CIFS Windows share on Linux using cifs-utils and credentials. Replace anything in brackets with your own details.

Install cifs-utils.

sudo apt update
sudo apt install cifs-utils

Create a credentials file with the Windows share login credentials.

vim creds

Both username and password are required, but domain is optional.

username=[username]
password=[password]
domain=[domain]

Create a mount point for the Windows share

sudo mkdir /mnt/[share]

Mount the Windows share using cifs-utils and the credentials file. Note that I am not securing my creds file or using a secure dir or file mode. These should be secured based on the details of your implementation.

sudo mount -t cifs //[server]/[share] /mnt/[share] \
  -o credentials=/home/app/creds,dir_mode=0777,file_mode=0777

The mount command only persists until the next reboot. This step is mainly for testing to make sure everything is working. We’ll make it permanent using /etc/fstab.

sudo vim /etc/fstab

Add the following line.

//[server]/[share] /mnt/[share] cifs credentials=/home/app/creds,dir_mode=0777,file_mode=0777 0 0

Now the share will mount on reboot.