I was trying to mount several folders from my LAN NAS (Zyxel NAS542) to build an automated backup server and I kept bumping into this error:
$ sudo mount /mnt/nas/bagr
mount error(5): Input/output error
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
$ dmesg | tail
[426845.904201] CIFS: Attempting to mount //192.168.1.10/bagr
[426845.914365] CIFS: VFS: \\192.168.1.10\bagr validate protocol negotiate failed: -13
[426845.915581] CIFS: VFS: cifs_mount failed w/return code = -5
The other folders from the same server mounted just fine. Just this one kept failing.
Then when I ssh-ed into the NAS I found out that the directory had incorrectly set permissions:
# ls -all
drwxrwxr-x 15 works works 4096 Jan 9 16:12 works
drwxrwx--- 15 bagr bagr 4096 Jan 9 16:12 bagr
For some reason the directory needs to have the “others” permissions set to read
and execute
so that the CIFS (SMB/Samba) may access that.
To fix this, I just did:
# chmod o+rx bagr
Done! Now the storage mounts successfully!