12

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.

Jeff Ward
  • 488
  • 1
  • 4
  • 14
  • Also adding the following (depending on your environment) to your fstab mount point. `sec=ntlmssp OR sec=ntlm OR sec=ntlmv2` – Mark McLean Sep 29 '14 at 14:28

1 Answers1

13

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.

Jeff Ward
  • 488
  • 1
  • 4
  • 14
  • 1
    nice question and answer - the error is definitely completely misleading... good job ;-) – nicorellius Sep 18 '13 at 21:09
  • also, in my case, I had some samba configuration issues that confounded the problem. it might help to check the `smb.conf` and make sure that the share is added correctly... – nicorellius Sep 18 '13 at 22:56
  • Doesn't seem to be a "silly mistake" because I run into the same problem and the error message didn't help me at all. Thanks for posting the solution! – scai Dec 03 '13 at 13:50