You are not logged in.
Hello to you!
Mounting network drives in Linux is like some form of black magic to me. Despite using Linux for so long I never could get a understanding in this subject.
I'm trying to put my credentials for my network drives in a separate file instead of having them in the fstab. But I can't get it to work.
Before my fstab looked like this:
//10.10.10.10/data-files /home/iriomote/data cifs uid=iriomote,gid=iriomote,username=iriomote,password=password123,noauto,x-systemd.automount,users,_netdev 0 0
//10.10.10.10/data-video /home/iriomote/video cifs uid=iriomote,gid=iriomote,username=iriomote,password=password123,noauto,x-systemd.automount,users,_netdev 0 0This worked fine for me. But if I change my fstab like this it does not work anymore:
//10.10.10.10/data-files /home/iriomote/data cifs uid=iriomote,gid=iriomote,credentials=/.credentials,noauto,x-systemd.automount,users,_netdev 0 0
//10.10.10.10/data-video /home/iriomote/video cifs uid=iriomote,gid=iriomote,credentials=/.credentials,noauto,x-systemd.automount,users,_netdev 0 0The path "/.credentials" is correct. I suspected file permission issues or problems with the availability of the /home mountpoint. For testing purposes I made the file readable by anyone.
The content is this:
iriomote@desktop ~$ cat /.credentials
username=iriomote
password=password123findmnt:
root@desktop ~$ findmnt
...
├─/home /dev/mapper/vg-home
│ │ ext4 rw,relatime,lazytime,discard,commit=120
│ ├─/home/iriomote/data systemd-1 autofs rw,relatime,fd=70,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=16447
│ └─/home/iriomote/video systemd-1 autofs rw,relatime,fd=74,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=16453This tells me, that something has mounted. But if I look in my home directory it looks like this:
iriomote@desktop ~$ ls -l /home/iriomote
total 32224
...
drwxr-xr-x 2 root root 0 May 27 21:39 data
...
-rw-r--r-- 1 iriomote iriomote 93K Apr 6 2022 raid.png
...
drwxr-xr-x 2 root root 0 May 27 21:39 video
...
-rw-r--r-- 1 iriomote iriomote 915K Mar 31 2021 wh_01.pngThe mount points are now owned by root and I cannot access them. And the size is 0 Byte which is strange.
iriomote@desktop ~$ ls -l /home/iriomote/data
ls: cannot open directory '/home/iriomote/data': No such devicedmesg:
root@desktop ~# dmesg
...
[ 519.764711] CIFS: enabling forceuid mount option implicitly because uid= option is specified
[ 519.764714] CIFS: enabling forcegid mount option implicitly because gid= option is specified
[ 519.764715] CIFS: Attempting to mount //10.10.10.10/data-files
[ 519.777976] CIFS: VFS: cifs_mount failed w/return code = -13
[ 519.778026] CIFS: enabling forceuid mount option implicitly because uid= option is specified
[ 519.778028] CIFS: enabling forcegid mount option implicitly because gid= option is specified
[ 519.778029] CIFS: Attempting to mount //10.10.10.10/data-video
[ 519.787649] CIFS: VFS: cifs_mount failed w/return code = -13Last edited by Iriomote (2026-05-28 15:32:05)
Offline
This tells me, that something has mounted.
No, tells you something will be mounted when trying to access the path.
stat /.credentialsWhat happens if you "chmod ugo+r" that?
Online
This tells me, that something has mounted.
No, tells you something will be mounted when trying to access the path.
stat /.credentialsWhat happens if you "chmod ugo+r" that?
Thank you for your time.
root@desktop ~#ls -la /.credentials
-rwxrwxrwx 1 iriomote iriomote 36 May 27 20:54 /.credentials
root@desktop ~# chmod ugo+r /.credentials
root@desktop ~#ls -la /.credentials
-rwxrwxrwx 1 iriomote iriomote 36 May 27 20:54 /.credentials
root@desktop ~# stat /.credentials
File: /.credentials
Size: 36 Blocks: 8 IO Block: 4096 regular file
Device: 253,2 Inode: 9156 Links: 1
Access: (0777/-rwxrwxrwx) Uid: ( 1000/ iriomote) Gid: ( 1000/ iriomote)
Access: 2026-05-27 21:38:45.831106831 +0200
Modify: 2026-05-27 20:54:09.567820028 +0200
Change: 2026-05-28 14:11:14.696603543 +0200
Birth: 2026-05-27 21:38:42.700098508 +0200
root@desktop ~#The behavior didn't change.
Offline
Because the permissions haven't - I could imaging cifs complaining this way because the file is completely unprotected => https://wiki.archlinux.org/title/Samba# … _passwords
Online
Okay, I got it to work now. It was a classic case of user error.
I was missing the smbclient package. After I installed it, it works.
But I ask myself how I was able to mount the samba share in the first place with the credentials in the fstab.
Shouldn't it work in any case without the smbclient package?
Thank you for the pointers.
Last edited by Iriomote (2026-05-28 15:31:43)
Offline
because cifs_mount is part of cifs-utils - not smb/samba
while support for a credential file seems to be samba exclusive and hence doesn't work with only cifs
Offline