假设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主机重启后失效,永久生效方法有两种:
1.在启动脚本中加入命令行
在文件/etc/rc.local添加
mount -t cifs //192.168.1.106/intel /mnt -o username='jsme',password='312'
若上述方法重启后未挂载请 chmod +x /etc/rc.d/rc.local赋予执行权限(/etc/rc.local为/etc/rc.d/rc.local 的软连接)
2.编辑/etc/fstab文件实现自动挂载
在该文件中新加一行
//192.168.1.200 /mnt cifs defaults,auto,username=jsme,password=312 0 0
系统重启后生效。