# smbpasswd -a kravchenko
New SMB password:
Retype new SMB password:
Added user kravchenko.
Шаг 7 Создайте файл /usr/local/etc/openldap/base.ldif. Внесите в него ваши начальные данные:
dn: dc=mycompany,dc=local
objectClass: dcObject
objectClass: organization
objectClass: top
dc:mycompany
o:mycompany
dn: ou=users,dc=mycompany,dc=local
objectClass: top
objectClass: organizationalUnit
ou: users
dn: ou=groups,dc=mycompany,dc=local
objectClass: top
objectClass: organizationalUnit
ou: groups
dn: ou=computers,dc=mycompany,dc=local
objectClass: top
objectClass: organizationalUnit
ou: computers
Шаг 8 Внесите содержимое созданного файла в базу OpenLDAP:
# ldapadd -W -x -D "cn=root,dc=mycompany,dc=local" -f \
? /usr/local/etc/openldap/base.ldif
adding new entry "dc=mycompany,dc=local"
adding new entry "ou=users,dc=mycompany,dc=local"
adding new entry "ou=groups,dc=mycompany,dc=local"
adding new entry "ou=computers,dc=mycompany,dc=local"
Шаг 9 Добавьте группы в OpenLDAP:
# ldapaddgroup admins
Successfully added group admins to LDAP
# ldapaddgroup users
Successfully added group people to LDAP
# ldapaddgroup computers
Successfully added group computers to LDAP
# ldapadduser kravchenko admins
Successfully added user kravchenko to LDAP
Successfully set password foruser kravchenko
Successfully created home directoryforuser kravchenko
Шаг 10 Сделайте сопоставление групп группам NT
# net groupmap add ntgroup="Domain Admins" \
? unixgroup=admins rid=512 type=domain
Successfully added group admins to the mapping db as a domain group# net groupmap add ntgroup="Domain Users" \
? unixgroup=users rid=513 type=domain
Successfully added group users to the mapping db as a domain group# net groupmap add ntgroup="Domain Computers" \
? unixgroup=computers rid=515 type=domain
Successfully added group computers to the mapping db as a domain group
Шаг 14 Введите компьютеры в домен. В Windows XP: правый клик на Мой компьютер -> Свойства -> Имя компьютера ->, является членом домена mycompany, вводим имя и пароль администратора (kravchenko).
Настройка Резервного Контроллера Домена
1. Установка программ
Шаг 1 Установите все программы как и для Главного Контроллера Домена
2. Настройка программ
Шаг 1 Выполните настроку программ как и для PDC, кроме: 1. Конфигурационный файл Samba для BDC - /usr/local/etc/smb.conf:
#======================= Global Settings =====================================
[global]
workgroup = mycompany
netbios name = bdc
server string =
security = user
encrypt passwords = yes
load printers = no
admin users = kravchenko
hostsallow = 192.168.1. 192.168.2. 127.
logfile = /var/log/samba/samba.log
max logsize = 50000
passdb backend = ldapsam:ldap://127.0.0.1
ldap suffix = dc=mycompany,dc=local
ldap user suffix = ou=users
ldap group suffix = ou=groups
ldap machine suffix = ou=computers
ldap admin dn = "cn=root,dc=mycompany,dc=local"
ldap delete dn = no
ldap ssl = off
ldap replication sleep = 5000
winbind uid = 10000-20000
winbind gid = 10000-20000
winbind separator = @
winbind use default domain = yes
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192local master = yes
os level = 65
domain master = no
preferred master = yes
domain logons = yes
logon path =
logon home = \\%L\homes
logon drive = H:
add machine script = /usr/local/bin/ldapaddmachine '%u' computers
adduser script = /usr/local/bin/ldapadduser '%u' users
addgroup script = /usr/local/bin/ldapaddgroup '%g'
addusertogroup script = /usr/local/bin/ldapaddusertogroup '%u' '%g'
delete user script = /usr/local/bin/ldapdeleteuser '%u'
delete group script = /usr/local/bin/ldapdeletegroup '%g'
delete userfromgroup script = /usr/local/bin/ldapdeleteuserfromgroup '%u' '%g'
set primary group script = /usr/local/bin/ldapsetprimarygroup '%u' '%g'
rename user script = /usr/local/bin/ldaprenameuser '%uold' '%unew
wins support = no
wins server = 192.168.1.2
wins proxy = yesdns proxy = no
display charset = koi8-r
unix charset = koi8-r
dos charset = cp866
time server = yes
load printers = no
enhanced browsing = Yes
remote announce = 192.168.1.2/mycompany
#============================ Share Definitions ==============================
[homes]
comment = Home Directories
path = /home/samba/homes/%U
browseable = no
writable = yes
public = noread only = no
create mask = 0600directory mask = 0700
valid users = %S
[netlogon]
comment = Network Logon Service
path = /usr/local/etc/samba/netlogon
browseable = no
guest ok = yes
writable = no
share modes = no
volume = NETLOGON
[profiles]
create mode = 0600directory mode = 700
path = /home/samba/profiles/%u
browseable = no
guest ok = yes
writeable = yes
[pub]
comment = Папка общего пользования
path = /home/samba/pub
valid users = @users
create mode = 666directory mode = 777
public = yes
writable = yes
printable = no
browseable = yes
[IPC$]
path = /tmp
hostsallow = 192.168.1.0/24192.168.2.0/24127.0.0.1hostsdeny = 0.0.0.0/0
Шаг 1 Отредактируйте конфигурационный файл OpenLDAP на Master -
/usr/local/etc/openldap/slapd.conf:
include /usr/local/etc/openldap/schema/core.schema
include /usr/local/etc/openldap/schema/cosine.schema
include /usr/local/etc/openldap/schema/inetorgperson.schema
include /usr/local/etc/openldap/schema/misc.schema
include /usr/local/etc/openldap/schema/nis.schema
include /usr/local/etc/openldap/schema/openldap.schema
include /usr/local/etc/openldap/schema/samba.schema
include /usr/local/etc/openldap/schema/mail.schema
pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args
allow bind_v2
modulepath /usr/local/libexec/openldap
moduleload back_ldbm
######################################################################## BDB database definitions#######################################################################
database ldbm
suffix "dc=mycompany,dc=local"
rootdn "cn=root,dc=mycompany,dc=local"
rootpw {SSHA}mu1MPXqqGNqPp9SV9DY4jSFbfxNqhoWt
loglevel 5directory /var/db/openldap-data
index objectClass,uid,uidNumber,gidNumber eq
index cn,mail,surname,givenname eq,subinitial
index sambaSID eq
index sambaPrimaryGroupSID eq
index sambaDomainName eq
replogfile /var/log/ldap/replica.log
replica uri=ldap://192.168.2.1:389
binddn="uid=replicator,ou=users,dc=mycompany,dc=local"
bindmetod=simple
credentials=password
access to attrs=userPassword
by self write
by anonymous auth
by * none
access to attrs=sambaLMPassword,sambaNTPassword
by dn="cn=root,dc=mycompany,dc=local" write
by * none
access to *
by self write
by anonymous read
by * none
Шаг 2 Создайте каталог и файл для логов репликации на Master сервере:
Шаг 5 Отредактируйте конфигурационный файл OpenLDAP на Slave - /usr/local/etc/openldap/slapd.conf:
include /usr/local/etc/openldap/schema/core.schema
include /usr/local/etc/openldap/schema/cosine.schema
include /usr/local/etc/openldap/schema/inetorgperson.schema
include /usr/local/etc/openldap/schema/misc.schema
include /usr/local/etc/openldap/schema/nis.schema
include /usr/local/etc/openldap/schema/openldap.schema
include /usr/local/etc/openldap/schema/samba.schema
include /usr/local/etc/openldap/schema/dnszone.schema
include /usr/local/etc/openldap/schema/dhcp.schema
include /usr/local/etc/openldap/schema/mail.schema
pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args
allow bind_v2
modulepath /usr/local/libexec/openldap
moduleload back_ldbm
######################################################################## BDB database definitions#######################################################################
database ldbm
suffix "dc=mycomapny,dc=local"
rootdn "cn=root,dc=mycompany,dc=local"
rootpw {SSHA}jVIuaP7Xpz+cpdFwH+dgLNzctfGngHx0
loglevel 5directory /var/db/openldap-data
index objectClass,uid,uidNumber,gidNumber eq
index cn,mail,surname,givenname eq,subinitial
index sambaSID eq
index sambaPrimaryGroupSID eq
index sambaDomainName eq
updatedn "uid=replicator,ou=users,dc=mycompany,dc=local"
updateref ldap://192.168.1.2:389
access to attrs=userPassword
by self write
by dn="uid=replicator,ou=users,dc=mycompany,dc=local" write
by anonymous auth
by * none
access to attrs=sambaLMPassword,sambaNTPassword
by dn="cn=root,dc=mycompany,dc=local" write
by dn="uid=replicator,ou=users,dc=mycompany,dc=local" write
by * none
access to *
by dn="uid=replicator,ou=users,dc=mycompany,dc=local" write
by self write
by anonymous read
by * none
Шаг 6 Перезапустите slapd на Slave сервере:
# /usr/local/etc/rc.d/slapd restart
Шаг 7 Добавьте на Master сервере в /etc/rc.conf строку:
slurpd_enable="YES"
Шаг 8 Запускаем slurpd на Master сервере, заодно перезагрузим slapd:
Цитата: "Теперь этот файл является резервной копией, его можно положить в надежное место и ограничить к нему доступ. Так же важно понимать, что теперь нельзя вносить изменения в основную базу до того, как мы не настроим репликацию."
Шаг 10 Скопируйте файл mycompany.ldif на Slave сервер:
Примечание! В случае обрыва связи между PDC и BDC, изменения, которые должны быть внесены в БД Slave, сохранятся в каталоге /var/db/openldap-slurp. И после восстановления связи изменения немедленно будут внесены в БД на Slave сервер.