美文网首页
Linux 挂载windows 共享目录

Linux 挂载windows 共享目录

作者: _W_D_ | 来源:发表于2019-10-08 19:46 被阅读0次

    前几天公司有个项目,是需要在服务器上运行一段程序,需要读一个资源库。但是资源库这么大,总不能全部传到服务器上去吧,好占地方,于是就想挂载下目录,中间遇到了一些小波折,把自己遇到的问题记录下,也希望能够帮助到其他人
    公司的服务器是Ubuntu的,Centos其实类似就不例举啦。废话不多说,下边一一记录

    • 挂载windows共享目录命令
    mount -t cifs -o username=windows用户名,password=windows密码 //windows的ip + 共享文件路径 linux挂载路径
    

    举个栗子:
    mount -t cifs -o username=xiaobai,password=123456 //1.1.1.1 /testdir /usr/picresource
    划重点 windows 和 linux 路径之间是有空格的!
    如果上边的命令输入后,石沉大海,什么都没有,那么恭喜你,挂载成功了!要是有问题的话…看下我下边遇到的有没有你的情况

    • 挂载遇到的问题
    1. 提示 mount error(121):remote error I/O error

    解决方法:

    去网上找了找,是说 NFS(Network File System)即网络文件系统服务器有多个版本导致的,在挂载的时候指定下nfs的版本就可以,就像这样:

    mount -t cifs -o username=xiaobai,password=123456,ver=2.1 //1.1.1.1 /testdir /usr/picresource
    
    1. 提示错误 block device //xxx is write-protected, mounting read-only
    sudo  mount -t cifs -o username=user,rw //xxxxxxx /mnt/xxx/ 
    mount: block device //xxx is write-protected, mounting read-only
    mount: cannot mount block device //xxx read-only
    

    解决方法:
    ubuntu
    sudo apt-get install cifs-utils
    centos
    yum install cifs-utils

    1. 提示错误 mount error(13): Permission denied
    mount error(13): Permission denied
    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
    

    解决方法:
    这个就是windows的用户名、密码、或者是ip写错啦(或者windows共享的目录没有开读写的权限哦)仔细检查下

    以上就是我遇到挂载目录时候遇到的问题了,希望能够帮助到遇到同样问题的小伙伴~

    相关文章

      网友评论

          本文标题:Linux 挂载windows 共享目录

          本文链接:https://www.haomeiwen.com/subject/loripctx.html