天天看點

CentOS挂載windows共享檔案夾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

繼續閱讀