LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 07-26-2007, 06:10 AM   #1
xpucto
Member
 
Registered: Sep 2005
Location: Madrid, Spain
Distribution: Suse
Posts: 492

Rep: Reputation: 30
mount: block device is write-protected, mounting read-only


Hallo!

I'm trying to mount a NAS from a FC. When I use the GUI "Places/connect to Server", I don't have any difficulty. when I try to mount with the command line I get this:
Quote:
sudo mount -t cifs -o username=myuser //XXX.XXX.XX.XX/myServer /home/myuser/backup
mount: block device //XXX.XXX.XX.XX/myServer is write-protected, mounting read-only
mount: cannot mount block device //XXX.XXX.XX.XX/myServer read-only
in the /var/log/message I have this:
Quote:
Jul 26 11:57:30 myServer kernel: CIFS VFS: Send error in SessSetup = -13
Jul 26 11:57:30 myServer kernel: CIFS VFS: cifs_mount failed w/return code = -13
Jul 26 11:57:30 myServer kernel: CIFS VFS: Send error in SessSetup = -13
Jul 26 11:57:30 myServer kernel: CIFS VFS: cifs_mount failed w/return code = -13
may anyone help me with this? doesn't the command line and the GUI use the same port?



thanks.
 
Old 01-05-2009, 08:41 AM   #2
kernst
LQ Newbie
 
Registered: Jan 2009
Location: Aiea, HI
Distribution: Debian Sarge/Etch, Ubuntu
Posts: 2

Rep: Reputation: 0
Lightbulb New version(s) of CIFS change expected behavior for those used to 'smbfs'

Reviving this old thread because it's the only one that described my exact problem: newer distros are beginning to default to 'cifs' and might not include the 'smbfs' package by default, which could change the expected behavior of the 'mount' command when mounting password-protected SMB shares. I ran into the problem using Ubuntu 8.04 (Hardy) and 8.10 (Intrepid) LiveCDs, but the information below should apply equally well to any new-ish distribution for which 'cifs' is being implemented as a replacement for 'smbfs'/'smbmount'.

A "vanilla" installation of Ubuntu 8.04/8.10 (Desktop i386) includes no 'smbmount' command, no '/sbin/mount.cifs' (although, confusingly, the man page is installed), and instead appears to rely on the 'cifs' loadable module to provide the capability of mounting SMB/CIFS shares via a kernel facility. This is similar to other network filesystems such as NFS, which are built into the kernel or loaded via modules and do not have their own mount.whatever command.

Some of the changes in switching over to 'cifs' are very subtle from a user perspective, like the meaning of the 'user' command (traditionally = "allow an ordinary user to mount the filesystem"; permitted by newer mount.cifs as a synonym for "username", as in "-ousername=myname"). Of note, the 'cifs' kernel module does not appear to allow prompting for a share password interactively at the command-line, as with smbmount/mount.cifs. It seems you must pass it explicitly on the command-line using the '-o password=' option. (This has always worried me because then your password ends up in your ".bash_history" file, but I guess that's no worse than using a 'credentials' file when you think about it, as both contain the plaintext passwords but neither is world-readable.)

The CIFS kernel module should be loaded dynamically as needed (perhaps when you give a 'mount -t cifs' command for the first time), but you can check to see that it is by typing:

Code:
$ cat /proc/filesystems
and looking for

Code:
...
nodev	cifs
...
in the output.

I was familiar with the options for 'smbmount' (or 'mount -t smbfs'), having used it many times on old RIPLinux and KNOPPIX boot CDs to mount shares on a NAS for system backups using GNU 'partimage'.

So when I booted up an Ubuntu 8.10 LiveCD, I expected

Code:
mount -t cifs //servername/sharename /local/mount/point -ousername=myname
to prompt me for a password; instead I got the same confusing error as the above poster:

Code:
mount: block device //servername/sharename is write-protected, mounting read-only
mount: cannot mount block device //servername/sharename read-only
I found two solutions: you can either (1) install the 'smbfs' package (yes--possible with the Live CD as long as you're connected to the Internet) to get an actual '/sbin/mount.cifs' which knows how to prompt for a password, and supports all the expected options from the man page, or (2) specify the password directly in the 'mount' command using the '-o password=' option as below:

Code:
mount -t cifs //servername/sharename /local/mount/point -o username=myname,password=supersecret
After checking all the permissions on my NAS share (and almost giving up and going back to trusty KNOPPIX), I started poking around on the filesystem of the Ubuntu Intrepid LiveCD and noted there was no 'mount.cifs' or 'smbmount'. This started me searching the web to figure out what the heck was going on. As there was no user-space program to prompt for a password (CIFS being loaded into the kernel instead), it almost makes sense that you'd have to specify the password as an option to 'mount -t cifs'. But it took a loooong time for me to finally figure this out.
 
Old 02-15-2010, 01:22 PM   #3
serodores
LQ Newbie
 
Registered: Oct 2008
Posts: 3

Rep: Reputation: 0
For RedHat

To solve this for RedHat, you basically have to make sure a few packages are installed. Namely samba.i386, samba-client.i386 from something like yum. There is no smbfs named package specifically for RedHat.
 
Old 04-16-2010, 05:40 PM   #4
damnmab
LQ Newbie
 
Registered: Apr 2010
Posts: 1

Rep: Reputation: 1
I had this exact same problem with Ubuntu 10.04 Lucid Lynx.
Using the -o password= option was the first thing I tried, but it didn't help. For me the only solution to this problem was to set up the smbfs package.
Code:
sudo apt-get install smbfs
One would expect that installing samba would also install smbfs, so this was quite unexpected to me.
 
1 members found this post helpful.
  


Reply

Tags
cifs, samba, smbfs


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/home partition is read-only write protected linux_newber Linux - Newbie 1 12-21-2006 05:58 PM
"block device /dev/sda2 is write-protected, mounting read-only" - fstab problem blanks77 Linux - Hardware 1 04-28-2006 07:09 PM
USB CF Card Reader/Write not a valid block device cromwell Linux - Hardware 10 01-06-2004 11:11 PM
Block Device and CD-Rom Mounting Alybyzrp Linux - Newbie 12 10-28-2003 08:45 AM
HELP! Error from mount: drive is write-protected... won't mount writeable. system Linux - General 2 12-27-2001 10:08 PM


All times are GMT -5. The time now is 05:43 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration