把Windows共享目录挂载到Linux服务器上

假设Windows的IP为192.168.1.106共享目录为C://Intel,则其共享地址为192.168.1.106/Intel。

挂在方法:

mount -t cifs //192.168.1.106/intel /mnt -o username='jsme',password='312'

此处username和password都是Windows主机的用户名和密码,该方法为root用户使用,挂载后owner和group都为root且挂在后目录不能用chmod修改目录权限

mount -t cifs //192.168.2.26/device /mnt/share -o username=share,password=share,rw,file_mode=0777,dir_mode=0777,setuid=509,setgid=101

其中,uid=509, gid=101是一个普通用户dba /mnt/share权限位是0777,所有用户有完全访问权限

卸载方法:

umount /mnt

------------------------------------------------------------------------------------------

以上方法立即生效但是在Linux主机重启后失效,永久生效方法为

修改/etc/fstab文件,文件最后加入:

//192.168.1.106/Inetl  /mnt cifs  username=‘jsme’,password=‘312’ ,rw  0 0

或在文件/etc/rc.local添加

mount -t cifs //192.168.1.106/intel /mnt -o username='jsme',password='312'

猜你喜欢

转载自www.linuxidc.com/Linux/2017-04/142822.htm
今日推荐