作者:晓晓鱼美人 | 来源:互联网 | 2017-06-14 21:48
通过samba让linux读取windows共享文件夹下的文件首先在Windows机器上共享出一个software目录,设置好目录的访问权限。本地Windows机器ip地址为192.168.10.58然后在linux上执行:Linux代码mount-tsmbfs&n
通过samba让linux读取windows共享文件夹下的文件
首先在Windows机器上共享出一个software目录,设置好目录的访问权限。本地Windows机器ip地址为192.168.10.58
然后在linux上执行:
mount -t smbfs -o username=administrator,password=''
//192.168.10.58/software
/share
或mount -t cifs -o username=administrator,password=''
//192.168.10.58/software
/share
如果提示mount: unknown filesystem type
'smbfs',mount不了windows的共享盘,是因为RHE5的kernel已经不再支持smbfs,而改用Common Internet File
Systemcifs(cifs)取代了原有的smbfs,所以,将原命令中的smbfs改成cifs即可。
如图:
这样就可以了。如果测试时,提示没有写文件权限,则执行:
-
umount /share
-
mount -t smbfs -o rw,fmask=775,dmask=777,uid=www,gid=www,username=administrator,password=''
//192.168.10.58/software /share
-
如果umount时报错:unmount error 16 =
Device or resource busy,则需要使用umount -l /var/www/share命令来卸载,这是启用了umount
lazy模式,在需要卸载的对象不忙的情况下卸载。