This process has worked in my setup to automount and dismount and external NAS.
Prerequisite is installing cifs-utils.
If you're using wifi, I also check the box "make this connection available for all users" in network manager.
Obviously, you’ll add your specific credentials in place of the generic names in the following.
sudo mkdir -p /media/nas/yourfilename
sudo chmod 777 /media/nas/yourfilename
sudo chown yourusername:yourusername /media/nas/yourfilename
sudo systemctl enable NetworkManager-wait-online.service
sudo chmod u+s /sbin/mount.cifs
sudo pluma /etc/fstab
In fstab, you'll add the following line to the end of the file.
//yournasaddress/nameofnasfilename /media/nas/nameofnasfilename cifs domain=yourdomainname,username=yourusername,password=yourpassword,x-systemd.automount,_netdev,users,uid=1000,gid=1000,rw,guest,vers=1.0 0 0
*Note that you may experiment whether you need "vers=1.0" or not. Sometimes not, other times it could be "vers=2.0" etc.
Additionally, there doesn't appear to be much difference between using a seperate credential file for you personal login data and just placing it directly in fstab. Both can be accessed, but only by root. Neither are encrypted.