服务端配置
[root@localhost ~]# yum install -y samba samba-client # 安装 Samba
[root@localhost ~]# vim /etc/samba/smb.conf # 修改配置文件
[global]
workgroup = WORKGROUP # 这里要与 Windows 的工作组一致
server string = Samba Server Version %v
security = share # 安全级别为 share ,即无需账号密码即可登录
passdb backend = tdbsam
load printers = yes
cups options = raw
[test] # 共享名
comment = share all # 描述信息,方便系统管理员查看
path = /tmp/sambadir # 共享的目录
browseable = yes # 共享的目录是否可见
public = yes # 共享的目录是否显示在网上邻居
writable = no # 是否可写
[root@localhost ~]# mkdir /tmp/sambadir # 创建共享的目录
[root@localhost ~]# /etc/init.d/smb start # 启动 Samba
Windows客户端访问
Linux 客户端访问(可以直接访问也可以通过挂载的方式来访问)
[root@localhost ~]# yum install -y samba-client # 安装 Samba 客户端软件包
[root@localhost ~]# smbclient //192.168.123.102/test # test 是共享名
Enter root‘s password: # 这里直接回车即可,无需账号密码
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.23-43.el6_9]
Server not using user level security and no password supplied.
smb: \>
[root@localhost ~]# yum install -y cifs-utils # cifs 是一种通用的网络文件系统
[root@localhost ~]# mount -t cifs //192.168.123.102/test /opt/ # 挂载到 /opt 目录
Password: # 直接回车即可