0

I'm on Kubuntu 24.04.1 and I've managed to succesfully mount a smb share with cifs by adding it in /etc/fstab, with this line:

//192.168.10.122/Test /mnt/Test cifs user,noauto,user=test,password=test 0 0

The problem is that the password is in plain text which is not secure. So I've followed a new guide, by creating a credential file (.smb_cred) with chmod 600 (read and write) and put this line instead:

//192.168.10.122/Test /mnt/Test cifs uid=1000,credentials=/home/test/.smb_cred,iocharset=utf8 0 0

The problem is that it doesn't work. I see the mounted file but it's empty.

muru
  • 207,228
Gamix
  • 11

1 Answers1

0

I'm on Kubuntu 24.04.1 and I've managed to succesfully mount a smb share with cifs by adding it in /etc/fstab, with this line:

//192.168.10.122/Test /mnt/Test cifs user,noauto,user=test,password=test 0 0

It's not automounting since you specified noauto in the declare statement. You have given a non-root user the ability to mount it however with the preceding user option.

//192.168.10.122/Test /mnt/Test cifs uid=1000,credentials=/home/test/.smb_cred,iocharset=utf8 0 0

That line is attempting to do the opposite. It's attempting to automatically mount the share at boot time.

After a reboot if the share doesn't mount open a terminal and run:

sudo mount -a

If the share is now mounted you can either:

  1. Incorporate the user,noauto method you used in the first declaration:

    //192.168.10.122/Test /mnt/Test cifs user,noauto,uid=1000,credentials=/home/test/.smb_cred 0 0
    
  2. Or, use a systemd automounter: x-systemd.automount:

    //192.168.10.122/Test /mnt/Test cifs uid=1000,credentials=/home/test/.smb_cred,iocharset=utf8,x-systemd.automount 0 0
    

Note: If you have an encrypted home directory the credentials file needs to be someplace else like /etc/samba/cred-files/.smb_cred

muru
  • 207,228
Morbius1
  • 8,437