部署samba服务之后,在客户端用挂载访问的方式,错误信息:mount: block device //192.168.1.108/mysqldata is write-protected, mounting read-only mount: cannot mount block device //192.168.1.108/mysqldata read-only

时间:2021-01-23 12:09:53

部署samba服务之后,在客户端用挂载访问的方式,错误信息:mount: block device //192.168.1.108/mysqldata is write-protected, mounting read-only mount: cannot mount block device //192.168.1.108/mysqldata read-only

1、系统环境

  • 物理机:Windows 7(32位)旗舰版
  • 虚拟机:CentOS 6.5

2、使用samba服务

在服务器上部署完成samba之后,客户端使用samba有两种方式:交换式访问和挂载访问。

  • 2.1交互式访问:

    基于smbclient交互式的命令行客户端
    • 查看共享:
    ~]# smbclient -L SAMBA_SERVER -U USERNAME
    • 访问共享:
    ~]# smbclient //SAMBA_SERVER/SERVICE_NAME -U USERNAME
  • 2.2挂载访问:

    基于mount -t cifs文件挂载访问方式
~]# mount -t cifs -o username=USERNAME,password=PASSWORD //SAMBA_SERVER/SHARED_DIR  /MOUNT_POINT

3、问题描述

基于挂载访问方式,在客户端上使用samba服务的时候,出现了以下的错误提示:

[root@promote ~]# mount -t cifs //192.168.1.108/mysqldata -o username=centos /mydata/data/
mount: block device //192.168.1.108/mysqldata is write-protected, mounting read-only
mount: cannot mount block device //192.168.1.108/mysqldata read-only

4、解决方法

  • 搜索:
[root@promote ~]# yum search cifs
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.btte.net
* updates: ftp.sjtu.edu.cn
==================================================================== N/S Matched: cifs ====================================================================
cifs-utils.i686 : Utilities for mounting and managing CIFS mounts
pcp-pmda-cifs.i686 : Performance Co-Pilot (PCP) metrics for the Cifs shell Name and summary matches only, use "search all" for everything.
  • 安装:
[root@promote ~]# yum install -y cifs-utils
  • 测试,重新挂载:
[root@promote ~]# mount -t cifs //192.168.1.108/mysqldata -o username=centos /mydata/data/
Password:
[root@promote ~]# mount | grep "^//"
//192.168.1.108/mysqldata on /mydata/data type cifs (rw)
[root@promote ~]# cd /mydata/data/
[root@promote data]# ls
fstab issue resolv.conf

5、结语

至此,就解决了,在客户端基于挂载访问方式,无法正常使用samba的问题。