LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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
 
Search this Thread
Old 07-26-2007, 05:10 AM   #1
xpucto
Member
 
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 522

Rep: Reputation: 31
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, 07: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, 12: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, 04: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.
Old 03-06-2014, 12:25 PM   #5
hiero2
LQ Newbie
 
Registered: May 2010
Posts: 26

Rep: Reputation: 2
This thread is still valid and useful. Using Linux Mint 13 on two machines, side by side. After setting up a new fileserver, I tried to login to same. One Mint 13 machine logged in a-ok, the other gave me the "read-only can not mount" business error message.

Installing smbfs fixed the problem. I noticed when installing that smbfs has a dependency on cifs-utils, which also got installed, and which may be the current culprit.

Don't ask me why one machine worked and the other did not - but I will say the machines are not identical, and they have some different things installed. One is a desktop, the other is a business laptop - different program requirements.

Well. That was easy!

Thanks for the thread!
 
Old 03-06-2014, 02:52 PM   #6
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,463

Rep: Reputation: 440Reputation: 440Reputation: 440Reputation: 440Reputation: 440
Quote:
Originally Posted by hiero2 View Post
This thread is still valid and useful. Using Linux Mint 13 on two machines, side by side. After setting up a new fileserver, I tried to login to same. One Mint 13 machine logged in a-ok, the other gave me the "read-only can not mount" business error message.

Installing smbfs fixed the problem. I noticed when installing that smbfs has a dependency on cifs-utils, which also got installed, and which may be the current culprit.

Don't ask me why one machine worked and the other did not - but I will say the machines are not identical, and they have some different things installed. One is a desktop, the other is a business laptop - different program requirements.

Well. That was easy!

Thanks for the thread!
now why in the world would you be using SAMBA to file share between Linux systems? that is like asking an Apple to taste like an Orange when you hand it to your friend. does not work properly.

Use NFS for sharing between Linux. NFS is the NATVIE file sharing protocol for Linux, Cifs/Samba is the NON-Native file sharing protocol for Linux to Microsoft Windows system. They are NOT the same, nor are they equal.
 
Old 03-07-2014, 02:08 PM   #7
hiero2
LQ Newbie
 
Registered: May 2010
Posts: 26

Rep: Reputation: 2
Quote:
Originally Posted by lleb View Post
now why in the world would you be using SAMBA to file share between Linux systems? that is like asking an Apple to taste like an Orange when you hand it to your friend. does not work properly.

Use NFS for sharing between Linux. NFS is the NATVIE file sharing protocol for Linux, Cifs/Samba is the NON-Native file sharing protocol for Linux to Microsoft Windows system. They are NOT the same, nor are they equal.
Nice of ya to be so helpful and polite and all, for sure. Much appreciated.

However,
1. your point is OT, yes?
2. uh - gets back to #1
3. but, since you ask, it is a mixed network, and I need to know the samba is working. Since there are a number of people on this and similar threads, it would appear I am not alone. Sometimes I use sshfs instead, but sshfs has bugs when it comes to crossing partitions with files and data, so sometimes I use the samba share.

But your point is duly noted.
 
  


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


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


All times are GMT -5. The time now is 02:35 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 Google+: linuxquestions
Open Source Consulting | Domain Registration