zoukankan      html  css  js  c++  java
  • 【mount】linux挂共享盘

    mount -t cifs -o username="共享用户",password="密码" //ip/sharing_folder /mountpoint
    可能提示

    mount: //xxx.xxx.xxx.xxx/xxx is write-protected, mounting read-only
    mount: cannot mount //xxx.xxx.xxx.xxx/xxx read-only
    

    yum -y install cifs-utils

    如何在Windows和Linux中共享文件?samba也许是个不错的选择。但是我用的CentOS5中若用smbfs就是一个“Wrong fs type”。仔细查找了相关资料,找出几个解决方法:
    1 mount -o username=your_name,password=your_password //server/share_folder /mount_point
    2 mount -t cifs username=your_name,password=your_password //server/share_folder /mount_point
    方法2在挂载windows共享盘的时候可能会出现 reomote I/o Error 这是因为nfs的版本也需要制定,有2,3,4等版本。可以在密码后面添加vers=2.1完成挂载
    这两种方法本质都一样,但要注意your_name用户必须对share_folder拥有完全操作的权限,当然若要只读甚至随便乱写个用户名密码都可 以。
    3 写到/etc/fstab文件中,在该文件最后添加一行:
    //server/share_folder /mount_point cifs username,password,rw
    这样还是有个缺点,即用户名和密码都以明文的方式暴露了,还可以这样:
    4 编辑/etc/fstab,按如下格式添加:
    //server/share_folder /mount_point cifs credential=/root/credential
    而/root/credential中内容如下:
    useername=your_name
    password=your_password
    但是还有个问题,普通用户是无权使用mount的,
    5 使用sudo
    6 对mount.cifs添加suid。

    问题

    用户密码正确的情况下挂载共享盘报错 permission define,是因为在windows设备上配置共享目录的时候,上层目录没有权限,导致这个报错,可以的话在上层配置共享目录,这样的话会减少报错的 2020年11月24日17点59分 删除,
    这个是错的,在上层不开启的情况下,地下的共享盘是可以共享出来的。另有原因。

    还可能是内核的影响,一般uname -a查看内核,3.1-3.7的用的sec是ntlm ,3.8的默认是ntlmssl,在-o后面配置的时候可以根据设备详情显式指定。
    在卸载共享盘的时候,umount 挂载点,如果出现busy,可以使用lsof 或者 fuser查看那个进程占用了这个盘,如果没有的话还是busy,看看是不是cd等命令在占用,

    1.报错 operation now in process

    同时 messages 中报错 kernel:CIFS VFS: Error connecting to socket.Aborting operation.....-115
    检查windows 的防火墙,同时需确认是否还有其他墙存在,在 linux 端 telnet ip 445查看墙的存在

    2. 报错 mount error(13): Permission denied

    message中报错 Aug 27 10:19:41 TA_Monitor1 kernel: CIFS VFS: cifs_mount failed w/return code = -13
    可能是用户密码错误,或者检查文件夹的共享 告警共享 安全等配置项

    vers说明

    vers=3.0  Windows 8, Windows Server 2012
    vers=2.1  Windows 7, Windows Server 2008 R2
    vers=2.0  Vista SP1, Windows Server 2008
    vers=1.0  Windows 95, NT 4.0
    
  • 相关阅读:
    C++test 关于resource参数和include/exclude参数说明
    开发程序 ip 127.0.0.0 0.0.0.0原理与区别
    安装rails旧版本出错bin_path': can't find gem railties (["3.0.5"]) with executable rails (Gem::GemNotFoundException)
    rails excel的创建
    ruby nil? empty? blank? 的区别
    rails 调试工具pry 换掉debugger 和 rails c
    rails respond_to 的原理与使用
    rails transaction 的用法
    ssh的传送文件命令
    出现了pid的错误A server is already running. 和如何改变webrick的端口值
  • 原文地址:https://www.cnblogs.com/cizao/p/12935466.html
Copyright © 2011-2022 走看看