mount.cifs Windows共享目录权限755问题

针对CentOS 6.5系统。


通过linux 的mount命令挂载windows下的共享目录,挂载后目录权限为755,普通用户没有权限写入。



可以通过file_mode 和dir_mode 来设置权限,覆盖默认的755权限。


通过linux的 man mount.cifs 简单的了解下。

       file_mode=arg
           If the server does not support the CIFS Unix extensions this overrides the default file mode.

       dir_mode=arg
           If the server does not support the CIFS Unix extensions this overrides the default mode for directories.

示例:

mount -t cifs -o username=ftp,password=3dmedcom,rw,dir_mode=0777,file_mode=0777 //10.10.172.91/GENEbackup       /GENEbackup  #这样看到的文件目录权限都为777
mount -t cifs -o username=ftp,password=3dmedcom //10.10.172.91/GENEbackup       /GENEbackup   #经测试,可以读写。这样看到的文件目录权限都为755


卸载:

当不需要使用这个分区的时候,需要将这个磁盘分区卸载。使用 umonut DEVICE 或者 umont DEVICE_POINT 来卸载。
但是,在卸载的时候我们刚好在访问这个目录,那么会提示设备忙,拒绝退出。
此时,有2种解决方案:1、退出此目录。2、使用fuser命令强制退出。
# fuser -v /GENEbackup  //fuser -v参数查看使用这个分区的用户和进程
# fuser -km /GENEbackup  //杀死访问挂载点的进程
# umount /GENEbackup   //可以正常卸载


猜你喜欢

转载自blog.51cto.com/dengaosky/2107593