Samba是通过两个服务控制的(nmbd用来管理工作群组,以及netbios name;smbd是利用对方给予的权限来取用资料,用来管理主机分享出去的目录,以及相关的打印设置等)(这里先不设置防火墙,所以先关闭或者清除到默认规则使用#iptables -F)
这里设置用户访问"共享"时,需要提供相应的用户名和密码(主要是进行服务器端的设置)
1、必须安装的套件
samba-common
samba-client
2、设置主机与ip的对应
[root@localhost ~]# cd /etc/samba
[root@localhost samba]# vi lmhosts
127.0.0.1 localhost
192.168.1.200 MYSERVER
192.168.1.188 ethnicity
3、修改配置文档
[root@localhost ~]# vi /etc/samba/smb.conf
workgroup = WORKGROUP
server string = Samba Server Version %v
netbios name = MYSERVER
security = user(启用用户认证)
encrypt passwords = yes(需要验证密码)
smb passwd file = /etc/samba/smbpasswd(相应的密码文档)
name resolve order = lmhosts bcast host(netbios name的解析顺序)
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
dns proxy = no
template shell = /bin/false
[homes](这个目录的设置是为了在现实共享目录时,用用户的名字取代这个home,因为这里设置的是用户的家目录)
comment = Home directories
browseable = no
writable = yes
valid users = %S
create mode = 0664
directory mode = 0775
[public]
comment = the user groups work directory
path = /home/public
public = yes
writable = yes
valid users = @users