Error mounting samba share, cannot mount block device xxxx read-only
After installing Ubuntu 12.04, I'm trying to mount a samba share from Windows under Linux, using a scripted command that's always worked, and the server hasn't changed.
The error is as follows:
$ mount -t cifs //<host>/<share> /media/<share> -o username=<user>,password=<pass>
mount: block device //<host>/<share> is write-protected, mounting read-only
mount: cannot mount block device //<host>/<share> read-only
$
I've read a lot of discussions about permissions, but unfortunately, that wasn't the issue. I'm submitting my own answer below for reference, hope this helps someone else.
Solution 1:
The error message is completely misleading, given the solution (for me anyway, I'm sure permissions problems might plague others, but in my case, this was a script that has always worked and a server that hadn't changed - only the client OS had changed). The solution for me was that the cifs-utils package was missing, as indicated by the missing file /sbin/mount.cifs
$ ls /sbin/mount.cifs
ls: cannot access /sbin/mount.cifs: No such file or directory
$ mount.cifs
The program 'mount.cifs' is currently not installed. You can install it by typing:
apt-get install cifs-utils
After installing cifs-utils using the above command, the mount worked fine.
I realize it's a silly mistake to use mount -t cifs without /sbin/mount.cifs, but the error message was completely misleading. I have a Samba server installed on this client machine, so perhaps that's why it's confused.