FSTAB proper syntax for mounted Windows share

Just began running 22.04 a few months back & now have 24.04 installed to host our accounting system. Initially I have a Windows 2019 server that I will be retiring & converting over to 24.04 sometime this year but in the interim, I am having a bit of trouble with writing to a mounted Windows share.

As long as I am working from the command line, everything works fine but, I am trying to get Restic with Backrest as the front-end to create respositories & write backups. I get “permission denied” messages in the Backrest log when it tries to get snapshots for the plan & when it tries to create a lock. I have an idea it is the way I have the FSTAB instruction written. Details about the mounted drive show being owned by root. The share on the Windows server is made by the user Administrator. Other than root, the only other user on this Ubuntu server is myself. I have tried the following in the FSTAB file:

//[server_name]/databackup/acctg /home/[ubuntu_user]/backup cifs credentials=/home/[ubuntu_user]/.smbcredentials 0 0

//[server_name]/databackup/acctg /home/[ubuntu_user]/backup cifs uid=0,gid=123,umask=007,credentials=/home/[ubuntu_user]/.smbcredentials 0 0

//[server_name]/databackup/acctg /home/[ubuntu_user]/backup cifs uid=[ubuntu_user],credentials=/home/[ubuntu_user]/.smbcredentials 0 0

Will certainly appreciate any insight that will help me overcome this particular stumbling block.

Hello Jon_AK - Welcome to Discourse :smiley:
Looks odd to me:

/home/[ubuntu_user]/.smbcredentials

Looks as “.” makes a redundancy. Where the period means - this file right here in the current working directory. But an explicit path is already provided.

Does the file exist in your /home directory?

ls -al /home/[ubuntu_user]/smbcredentials
  • Maybe so -

Hi. yes, the file resides in my home directory. I was following an article that is accessible from this forum https://documentation.ubuntu.com/server/how-to/samba/mount-cifs-shares-permanently/

Well -

May I suggest you try without the period - // the use here still makes no sense to me.
As a reference:

//192.168.100.123/freenas /mnt/freenas cifs credentials=/home/myuser/freenaspasswords,iocharset=utf8,uid=myuser 0 0
  • all that glitters is not pure gold-

Going to the guide you referenced it should be:

//servername/sharename /media/windowsshare cifs credentials=/home/ubuntuusername/.smbcredentials 0

basically one to many zeros after the .smbcredentials (which seems to be across the board for every .smbcredentials listing)
many not be the cure… or the fix not up to date on SMB but looking over the guide and your posted Fstab file it is what I noticed.

I did find the problem with this. I had most of the FSTAB entry correct but did not have the uid or gid numbers correct. I found my uid & gid number by running the id command, unmounted the share & changed the FSTAB file to this:
//[servername or IP address]/[sharename] /home/[ubuntu_user]/[mount_location] cifs uid=1000,gid=1000,credentials=/[path_to.smbcredentials file] 0 0
I rebooted the server & ran the backrest front end & the permission error have vanished with the backup working as it is supposed to.
I appreciate your input, gave me a way to change my thinking.

Jon_AK :smiley:

Thanks for providing your solution:

Please mark this thread “solved” as an aid to others looking for a similar solution.

-off into the Wild Blue Yonder-