CentOS挂载windows共享文件夹

CentOS挂载windows共享文件夹

1、挂载命令

​ mount -t cifs -o username=user,password=123456,gid=500,uid=500 //{ip}/upload /share/upload

2、遇到的问题及解决方法

a、mount: block device //{ip}/upload is write-protected, mounting read-only

​ mount: cannot mount block device //{ip}/result read-only

​ 或mount: wrong fs type, bad option, bad superblock on \{ip}{dir}

​ missing codepage or helper program, or other error

​ (for several filesystems (e.g. nfs, cifs) you might

​ need a /sbin/mount. helper program)

​ In some cases useful info is found in syslog - try

​ dmesg | tail or so

解决方法:

​ yum search cifs

​ yum install -y cifs-utils

b、mount error(13): Permission denied

​ Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

解决方法:

​ 切换用户。

c、umount: /mnt/files: device is busy.

​ (In some cases useful info about processes that use

​ the device is found by lsof(8) or fuser(1))

解决方法:

​ 退出一次窗口。

d、mount -t cifs -ro username=user,password=123456 //{ip}/[{dir}/{dir}/{dir}] /share/upload

提示:mount: //{ip}/upload is not a valid block device

原因:只能挂一层

解决方法:

​ windows上面FileUpload目录设置共享,命令修改为:

mount -t cifs -o username=user,password=123456 //{ip}/upload /share/upload

e、上传文件:提示The upload destination folder does not appear to be writable.(没有写入权限)

解决方法:

挂载时设置权限组,命令如下:mount -t cifs -o username=user,password=123456,gid=500,uid=500 //{ip}/upload /share/upload

500为www。

f、mount -t cifs -o username=user,password=123456 \{ip}/{dir} /share/upload

出现错误提示:mount.cifs: bad UNC (\{ip}/{dir})

正常为:

mount -t cifs -o username=user,password=123456 //{ip}/{dir} /share/upload

3、项目中的使用步骤

1、创建文件夹,修改拥有者权限

2、挂载 mount -t cifs -o username=guest,password=”“,gid=501,uid=501 //192.168.1.24/upload /share/upload

3、软链

cd /usr/local/nginx/html/website/

ln -s /share/upload upload

遇到的问题:

PHP写入文件时出现:The upload destination folder does not appear to be writable

解决方法:挂载时指定目录权限或者挂载命令增加gid=501,uid=501。

http://www.centoscn.com/image-text/config/2014/0718/3308.html

参考地址:

http://www.cnblogs.com/maning2018/p/6241462.html?utm_source=itdadao&utm_medium=referral

http://blog.sina.com.cn/s/blog_544f183101013zd7.html

http://blog.csdn.net/pearhuaer/article/details/8681359

你可能感兴趣的:(Linux,共享文件夹,windows,centos,mount)