linux操作系统中访问内网的windows共享文件夹,一般使用samba。samba基于SMB(SMB又称为Common Internet File System(CIFS)),只要在linux中挂载cifs类型的目录即可。我使用的是redhat,内核版本是2.6。
1.安装
在终端输入命令:
sudo yum -y install samba
sudo yum -y install samba-client
注意samba-client一定要安装,否则挂载时会出现“mount: wrong fs type, bad option, bad superblock”这样的错误提示。
2.挂载
挂载前先建立好文件夹。
mount命令格式如下:
[leafry@xxxxxx /mnt]$ sudo mount -t cifs -o username=domainName/userxxx,password=passwordxxx //10.10.10.10/dirName/ /mnt/monkey/
前一个目录是你的windows共享文件夹目录,后一个是需要被挂载到的linux目录。这里的username和password填写访问该机器的账号密码,我在进行挂载的时候总出现访问拒绝的错误:
mount error 13 = Permission denied
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)
原因就在于需要加上账号所在的域,域和账号之间需要以/作为分隔符,而不是windows下的"\"
【参考】
http://easwy.com/blog/archives/mount-a-windows-shared-folder-on-linux-with-samba/
http://forums.fedoraforum.org/archive/index.php/t-165994.html