下面是我的Ubuntu服务器上的Samba配置文件的示例/etc/samba/smb.conf,在我们配置smb.conf之前,确保已经备份了这个文件。
root@ubuntuserver:/home/username# cp /etc/samba/smb.conf /etc/samba/smb.confbak
root@ubuntuserver:/home/username# nano /etc/samba/smb.conf
#/etc/samba/smb.conf
[global]
workgroup = EXAMPLE
realm = EXAMPLE.NET
netbios name = yourservername
server string = %h server (Samba %v, Ubuntu)
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
security = ADS
domain master = no
idmap uid = 10000-20000
idmap gid = 10000-20000
template shell = /bin/bash
template homedir = /home/%D/%U
winbind enum groups = yes
winbind enum users = yes
winbind use default domain = yes
winbind separator = +
usershare allow guests = yes
完成配置后,那么我们需要使用testparm检查配置是否正确。输入:
root@ubuntuserver:/home/username# testparm
测试Samba配置文件后,重启winbind和Samba服务
:
root@ubuntuserver:/home/username# /etc/init.d/winbind stop
root@ubuntuserver:/home/username# /etc/init.d/samba restart
root@ubuntuserver:/home/username# /etc/init.d/winbind start
下面输入下列命令,把你的Ubuntu服务器加入到AD域中:
root@ubuntuserver:/home/username# net ads join -U Administrator@EXAMPLE.NET
Administrator’s Password:*********
Using short domain name – EXAMPLE
Joined ‘yourservername’ to realm ‘EXAMPLE.NET’
就是这样,在Active Directory中的computers中出现你的服务器名字。你可以随意把你的Samba服务器移动哪个OU。一旦你成功的添加你的Samba服务器到AD中,下一步要做的就是修改nsswitch.conf文件,来设置winbind认证。