一 前言
需要在linux和windows 间互传数据,在windows 上安装cygwin再安装openssh比较麻烦,如果在windows上只安装ssh客户端的话,又无法实现linux往windows上传数据。
因此选用samba
二 解决方案
安装samba
#yum install samba
启动samba服务
#smb start
从linux上访问windows共享文件夹
- [niy@niy-computer /]$ smbclient -L 192.168.251.15
- Enter niy’s password:
- Domain=[WANGFANG-PC] OS=[Windows 7 Ultimate 7601 Service Pack 1] Server=[Windows 7 Ultimate 6.1]
- Sharename Type Comment
- ——— —- ——-
- ADMIN$ Disk 远程管理
- C$ Disk 默认共享
- D$ Disk 默认共享
- Documents Disk
- E$ Disk 默认共享
- IPC$ IPC 远程 IPC
- session request to 192.168.251.15 failed (Called name not present)
- session request to 192 failed (Called name not present)
- session request to *SMBSERVER failed (Called name not present)
- NetBIOS over TCP disabled — no workgroup available
出现以上提示证明成功
挂载windows共享文件
- [niy@niy-computer /]$ sudo mount -t smbfs -o username=niy,password=123456 //192.168.251.15/Documents /mnt/wangfang-docs/
- mount: unknown filesystem type ‘smbfs’
提示出错:
mount:unknown
filesystemtype ‘smbfs’
将smbfs改为cifs,
- [niy@niy-computer /]$ sudo mount -t cifs -o username=’niy’,password=’123456′ //192.168.251.15/Documents /mnt/wangfang-docs
成功!!
来源URL:http://blog.csdn.net/duguduchong/article/details/8973607