Samba + LDAP (PDC)

Опубликовано nekit - ср, 23/03/2011 - 18:40

Эта статья является доработкой предыдущей статьи, в которой учтены недостатки и реализованы новые идеи. В этой статье будет рассмотрена настройка самбы в качестве главного контроллера домена с хранением всей служебной информации в LDAP.
Итак, приступим... ОС, на которой будут производиться все операции - FreeBSD 7.3. Предполагается, что система чистая, а если нет, то удалите старые пакеты :). Обновляем порты. Далее устанавливаем сервер LDAP, в качестве такого я выбрал OpenLDAP.

  1. # cd /usr/ports/net/openldap24-server
  2. # make install clean
Из предложенных опций я выбрал следующие:
  • FETCH
  • TCP_WRAPPERS
  • SEQMOD
  • SYNCPROV
  • DYNAMIC_BACKENDS
Поддержку Berkley DB я убрал, так как народу у меня немного, соответственно хранить все можно в текстовых файлах. Если планируется много пользователей, то лучше использовать Berkley DB, ибо это хранилище быстрее работает. После установки лезем править конфиг /usr/local/etc/openldap/slapd.conf. У меня он выглядит так:
  1. #
  2. # See slapd.conf(5) for details on configuration options.
  3. # This file should NOT be world readable.
  4. #
  5. include         /usr/local/etc/openldap/schema/core.schema
  6.  
  7. # Подключаем дополнительные схемы
  8. include         /usr/local/etc/openldap/schema/cosine.schema
  9. include         /usr/local/etc/openldap/schema/inetorgperson.schema
  10. include         /usr/local/etc/openldap/schema/nis.schema
  11. #include         /usr/local/etc/openldap/schema/samba.schema
  12.  
  13. # Define global ACLs to disable default read access.
  14.  
  15. # Do not enable referrals until AFTER you have a working directory
  16. # service AND an understanding of referrals.
  17. #referral       ldap://root.openldap.org
  18.  
  19. pidfile         /var/run/openldap/slapd.pid
  20. argsfile        /var/run/openldap/slapd.args
  21.  
  22. # Подгружаем нужный модуль:
  23. modulepath      /usr/local/libexec/openldap
  24. # moduleload    back_bdb
  25. # moduleload    back_hdb
  26. moduleload      back_ldap
  27.  
  28. # Sample security restrictions
  29. #       Require integrity protection (prevent hijacking)
  30. #       Require 112-bit (3DES or better) encryption for updates
  31. #       Require 63-bit encryption for simple bind
  32. # security ssf=1 update_ssf=112 simple_bind=64
  33.  
  34. # Sample access control policy:
  35. #       Root DSE: allow anyone to read it
  36. #       Subschema (sub)entry DSE: allow anyone to read it
  37. #       Other DSEs:
  38. #               Allow self write access
  39. #               Allow authenticated users read access
  40. #               Allow anonymous users to authenticate
  41. #       Directives needed to implement policy:
  42. # access to dn.base="" by * read
  43. # access to dn.base="cn=Subschema" by * read
  44.  
  45. # Указываем права доступа к данным
  46. access to attrs=userPassword
  47.                 by self write
  48.                 by anonymous auth
  49.                 by * none
  50.  
  51. access to *
  52.                 by self write
  53.                 by users read
  54.                 by anonymous read
  55.                 by * none
  56.  
  57. #
  58. # if no access controls are present, the default policy
  59. # allows anyone and everyone to read anything but restricts
  60. # updates to rootdn.  (e.g., "access to * by * read")
  61. #
  62. # rootdn can always read and write EVERYTHING!
  63.  
  64. #######################################################################
  65. # BDB database definitions
  66. #######################################################################
  67.  
  68. # В этой опции указываем хранилище
  69. database        ldif
  70. suffix          "dc=srv-home,dc=local"
  71. rootdn          "cn=root,dc=srv-home,dc=local"
  72. # Пароль для главного пользователя.
  73. # Генерируется командой slappasswd, вывод команды просто скопировать сюда.
  74. # Дополнительно за информацией обращайтесь в ман - slappasswd(8) и slapd.conf(5).
  75. rootpw          {SSHA}XguytGYPdcylFxV60TD7DwhRy9AXML95
  76. # Здесь указываем папку, где будет располагаться база данных.
  77. # Она должна быть создана перед запуском slapd.
  78. # Рекомендуется установить на нее следующие права доступа - 700.
  79. directory       /var/db/openldap-data
  80.  
  81. # Настройка ведения логов
  82. logfile         /var/log/openldap.log
  83. loglevel        256
Где взять файл samba.schema будет сказано далее в статье. Теперь добавим демон slapd в автозагрузку и попробуем запустить:
  1. # echo 'slapd_enable="YES"' >> /etc/rc.conf
  2. # echo "slapd_flags='-h \"ldapi://%2fvar%2frun%2fopenldap%2fldapi/ ldap://127.0.0.1/ ldap://192.168.7.250/\"'" >> /etc/rc.conf
  3. # service slapd start
Если все прошло нормально, то у вас должно быть примерно следующее:
  1. # sockstat -l | grep slapd
  2. ldap     slapd      36521 6  stream /var/run/openldap/ldapi
  3. ldap     slapd      36521 7  tcp4   127.0.0.1:389         *:*
  4. ldap     slapd      36521 8  tcp4   192.168.7.250:389     *:*
Наполним лдап базовой информацией. Для этого нужно создать отдельный файл, внести в него нужную информацию и добавить командой ldapadd.
  1. dn: dc=srv-home,dc=local
  2. objectClass: dcObject
  3. objectClass: organization
  4. objectClass: top
  5. dc: srv-home
  6. o: srv-home
  7.  
  8. dn: cn=root,dc=srv-home,dc=local
  9. objectClass: organizationalRole
  10. cn: root
  11.  
  12. dn: ou=users,dc=srv-home,dc=local
  13. objectClass: top
  14. objectClass: organizationalUnit
  15. ou: users
  16.  
  17. dn: ou=groups,dc=srv-home,dc=local
  18. objectClass: top
  19. objectClass: organizationalUnit
  20. ou: groups
  21.  
  22. dn: ou=computers,dc=srv-home,dc=local
  23. objectClass: top
  24. objectClass: organizationalUnit
  25. ou: computers
Сохраните этот текст например в файле main.ldif и добавляем данные:
  1. # ldapadd -x -D "cn=root,dc=srv-home,dc=local" -W -f main.ldif
  2. Successfully added...
С настройкой OpenLDAP пока закончили. Сейчас надо установить скрипты, которые облегчат управление пользователями в лдапе и NSS модуль, который будет сопоставлять имя пользователя и идентификатор. Со скриптами все просто, идем сюда - /usr/ports/net/ldapscripts и устанавливаем. А теперь надо подправить чуток конфиг /usr/local/etc/ldapscripts/ldapscripts.conf.
  1. # LDAP Configuration
  2. SERVER="ldap://localhost"
  3. BINDDN="cn=root,dc=srv-home,dc=local"
  4. # The following file contains the raw password of the binddn
  5. # Create it with something like : echo -n 'secret' > $BINDPWDFILE
  6. # WARNING !!!! Be careful not to make this file world-readable
  7. #BINDPWDFILE="/usr/local/etc/ldapscripts/ldapscripts.passwd"
  8. # For older versions of OpenLDAP, it is still possible to use
  9. # unsecure command-line passwords by defining the following option
  10. # AND commenting the previous one (BINDPWDFILE takes precedence)
  11. BINDPWD="*****"
  12.  
  13. SUFFIX="dc=srv-home,dc=local" # Global suffix
  14. GSUFFIX="ou=groups"        # Groups ou (just under $SUFFIX)
  15. USUFFIX="ou=users"         # Users ou (just under $SUFFIX)
  16. MSUFFIX="ou=computers"      # Machines ou (just under $SUFFIX)
  17.  
  18. # Start with these IDs *if no entry found in LDAP*
  19. GIDSTART="20000" # Group ID
  20. UIDSTART="20000" # User ID
  21. MIDSTART="30000" # Machine ID
  22.  
  23. # User properties
  24. USHELL="/usr/sbin/nologin"
  25. UHOMES="/mnt/media/home/%u"     # You may use %u for username here
  26. CREATEHOMES="no"      # Create home directories and set rights ?
  27. #HOMESKEL="/etc/skel"  # Directory where the skeleton files are located. Ignored if undefined or nonexistant.
  28. HOMEPERMS="700"       # Default permissions for home directories
  29.  
  30. # User passwords generation
  31. # Command-line used to generate a password for added users (you may use %u for username here)
  32. # WARNING !!!! This is evaluated, everything specified here will be run !
  33. # Special value "<ask />" will ask for a password interactively
  34. #PASSWORDGEN="cat /dev/random | LC_ALL=C tr -dc 'a-zA-Z0-9' | head -c8"
  35. PASSWORDGEN="head -c8 /dev/random | uuencode -m - | sed -n '2s|=*$||;2p' | sed -e 's|+||g' -e 's|/||g'"
  36. #PASSWORDGEN="pwgen"
  37. #PASSWORDGEN="echo changeme"
  38. #PASSWORDGEN="echo %u"
  39. #PASSWORDGEN="<ask />"
  40.  
  41. # User passwords recording
  42. # you can keep trace of generated passwords setting PASSWORDFILE and RECORDPASSWORDS
  43. # (useful when performing a massive creation / net rpc vampire)
  44. # WARNING !!!! DO NOT FORGET TO DELETE THE GENERATED FILE WHEN DONE !
  45. # WARNING !!!! DO NOT FORGET TO TURN OFF RECORDING WHEN DONE !
  46. RECORDPASSWORDS="no"
  47. PASSWORDFILE="/var/log/ldapscripts_passwd.log"
  48.  
  49. # Where to log
  50. LOGFILE="/var/log/ldapscripts.log"
  51.  
  52. # Temporary folder
  53. TMPDIR="/tmp"
  54.  
  55. # Various binaries used within the scripts
  56. # Warning : they also use uuencode, date, grep, sed, cut, expr, which...
  57. # Please check they are installed before using these scripts
  58. # Note that many of them should come with your OS
  59.  
  60. # OpenLDAP client commands
  61. LDAPSEARCHBIN="/usr/local/bin/ldapsearch"
  62. LDAPADDBIN="/usr/local/bin/ldapadd"
  63. LDAPDELETEBIN="/usr/local/bin/ldapdelete"
  64. LDAPMODIFYBIN="/usr/local/bin/ldapmodify"
  65. LDAPMODRDNBIN="/usr/local/bin/ldapmodrdn"
  66. LDAPPASSWDBIN="/usr/local/bin/ldappasswd"
  67.  
  68. # Character set conversion : $ICONVCHAR  UTF-8
  69. # Comment ICONVBIN to disable UTF-8 conversion
  70. ICONVBIN="/usr/local/bin/iconv"
  71. ICONVCHAR="KOI8-R"
  72.  
  73. # Base64 decoding
  74. # Comment UUDECODEBIN to disable Base64 decoding
  75. UUDECODEBIN="/usr/bin/uudecode"
  76.  
  77. # Getent command to use - choose the ones used
  78. # on your system. Leave blank or comment for auto-guess.
  79. # GNU/Linux
  80. #GETENTPWCMD="getent passwd"
  81. #GETENTGRCMD="getent group"
  82. # FreeBSD
  83. GETENTPWCMD="pw usershow"
  84. GETENTGRCMD="pw groupshow"
  85. # Auto
  86. #GETENTPWCMD=""
  87. #GETENTGRCMD=""
  88.  
  89. # You can specify custom LDIF templates here
  90. # Leave empty to use default templates
  91. # See *.template.sample for default templates
  92. #GTEMPLATE="/path/to/ldapaddgroup.template"
  93. #UTEMPLATE="/path/to/ldapadduser.template"
  94. #MTEMPLATE="/path/to/ldapaddmachine.template"
  95. GTEMPLATE=""
  96. UTEMPLATE=""
  97. MTEMPLATE=""
Теперь нужно установить NSS модуль, который будет сопоставлять имя пользоватя и идентификатор.
  1. # cd /usr/ports/net/nss_ldap
  2. # make install clean
И снова правим конфиг.
  1. # Your LDAP server. Must be resolvable without using LDAP.
  2. # Multiple hosts may be specified, each separated by a
  3. # space. How long nss_ldap takes to failover depends on
  4. # whether your LDAP client library supports configurable
  5. # network or connect timeouts (see bind_timelimit).
  6. host 127.0.0.1
  7.  
  8. # The distinguished name of the search base.
  9. base dc=srv-home,dc=local
  10.  
  11. # The LDAP version to use (defaults to 3
  12. # if supported by client library)
  13. ldap_version 3
  14.  
  15. # The port.
  16. # Optional: default is 389.
  17. port 389
  18.  
  19. # The search scope.
  20. #scope sub
  21. scope one
  22. #scope base
  23.  
  24. # Reconnect policy:
  25. #  hard_open: reconnect to DSA with exponential backoff if
  26. #             opening connection failed
  27. #  hard_init: reconnect to DSA with exponential backoff if
  28. #             initializing connection failed
  29. #  hard:      alias for hard_open
  30. #  soft:      return immediately on server failure
  31. bind_policy soft
  32.  
  33. # Connection policy:
  34. #  persist:   DSA connections are kept open (default)
  35. #  oneshot:   DSA connections destroyed after request
  36. nss_connect_policy persist
  37.  
  38. # Use paged rseults
  39. nss_paged_results yes
  40.  
  41. # RFC2307bis naming contexts
  42. nss_base_passwd ou=users,dc=srv-home,dc=local?one
  43. nss_base_passwd ou=computers,dc=srv-home,dc=local?one
  44. nss_base_shadow ou=users,dc=srv-home,dc=local?one
  45. nss_base_group          ou=groups,dc=srv-home,dc=local?one
После настройки модуля нужно сказать системе, что информацию о идентификаторах можно получать еще через него. Для этого правим файл - /etc/nsswitch.conf, точнее всего две строчки в нем.
  1. group: files ldap
  2. passwd: files ldap
Проверим работоспособность настроенной связки:
  1. # ldapaddgroup testgroup
  2. Successfully added group testgroup to LDAP
  3. # ldapadduser testuser testgroup
  4. Successfully added user testuser to LDAP
  5. Successfully set password for user testuser
  6. # lsldap
  7. ...
  8. dn: cn=testgroup,ou=groups,dc=srv-home,dc=local
  9. objectClass: posixGroup
  10. cn: testgroup
  11. gidNumber: 20016
  12. description: Group account
  13.  
  14. dn: uid=testuser,ou=users,dc=srv-home,dc=local
  15. objectClass: account
  16. objectClass: posixAccount
  17. cn: testuser
  18. uid: testuser
  19. uidNumber: 20004
  20. gidNumber: 20016
  21. homeDirectory: /mnt/media/home/testuser
  22. loginShell: /usr/sbin/nologin
  23. gecos: testuser
  24. description: User account
  25. userPassword:: e1NTSEF9RzVTakJBZjMyM1d6b2ZycWpUZ0hIRXhnak0vdnlTWCs=
  26. ...
  27. # id testuser
  28. uid=20004(testuser) gid=20016(testgroup) groups=20016(testgroup)
Если у вас в выводе команд наблюдается, что-то подобное, то все работает нормально. Удалить пользователя и группу можно командами - ldapdeleteuser и ldapdeletegroup. приступаем к установке и настройке самбы.
  1. # cd /usr/ports/net/samba34
  2. # make install clean
Опции, которые я выбрал:
  • LDAP
  • ACL_SUPPORT
  • QUOTAS
  • POPT
После завершения установки надо скопировать схему samba.schema в папку схем openldap:
  1. # cp /usr/local/share/examples/samba34/LDAP/samba.schema /usr/local/etc/openldap/schema
Теперь раскомментируем строку в файле slapd.conf, где подключается только что скопированная схема и перезапускаем демон slapd. Ну и идем править конфиг самбы.
  1. #======================= Global Settings =====================================
  2. [global]
  3.    workgroup = HOME
  4.    server string = Documents
  5.    netbios name = srv-home.local
  6.  
  7.    security = user
  8.    hosts allow = 192.168.7. 127.
  9.    load printers = no
  10.    printing = bsd
  11.    #guest account = nobody
  12.    #log file = /var/log/samba34/log.%m
  13.    log file = /dev/null
  14.    log level = 0
  15.    max log size = 5000
  16.    encrypt passwords = yes
  17.    #passdb backend = tdbsam
  18.    passdb backend = ldapsam:ldap://localhost/
  19.    ldap suffix = dc=srv-home,dc=local
  20.    ldap user suffix = ou=users
  21.    ldap group suffix = ou=groups
  22.    ldap machine suffix = ou=computers
  23.    ldap admin dn = "cn=root,dc=srv-home,dc=local"
  24.    ldap delete dn = no
  25.    ldap ssl = no
  26.  
  27.    ;include = /usr/local/etc/smb.conf.%m
  28.  
  29.    read raw = yes
  30.    write raw = yes
  31.    use sendfile = yes
  32.    socket options = IPTOS_LOWDELAY TCP_NODELAY SO_SNDBUF=32768 SO_RCVBUF=32768 SO_KEEPALIVE
  33.  
  34.    interfaces = 192.168.7.250/24 127.0.0.1/8
  35.    bind interfaces only = yes
  36.    local master = yes
  37.    domain master = yes
  38.    preferred master = yes
  39.  
  40.    os level = 65
  41.    domain logons = yes
  42.    wins support = yes
  43.    time server = yes
  44.  
  45.    admin users = nekit
  46.    logon path = \\%L\profiles\%U
  47.    logon drive = H:
  48.    logon home = \\%L\%U
  49.    logon script = logon.cmd
  50.  
  51.    display charset = koi8-r
  52.    unix charset = koi8-r
  53.    dos charset = cp866
  54.  
  55.    case sensitive = no
  56.  
  57.    store dos attributes = yes
  58.  
  59. # Скрипт, для добавления машин
  60.    add machine script = /usr/local/sbin/ldapaddmachine '%u' smb_pdc_computers
  61.    add user script = /usr/local/sbin/ldapadduser '%u' smb_pdc_users
  62.    add group script = /usr/local/sbin/ldapaddgroup '%g'
  63.    add user to group script = /usr/local/sbin/ldapaddusertogroup '%u' '%g'
  64.    delete user script = /usr/local/sbin/ldapdeleteuser '%u'
  65.    delete group script = /usr/local/sbin/ldapdeletegroup '%g'
  66.    delete user from group script = /usr/local/sbin/ldapdeleteuserfromgroup '%u' '%g'
  67.    set primary group script = /usr/local/sbin/ldapsetprimarygroup '%u' '%g'
  68.    rename user script = /usr/local/sbin/ldaprenameuser '%uold' '%unew'
  69.  
  70. #============================ Share Definitions ==============================
  71. [netlogon]
  72.    comment = Netlogon Service
  73.    path = /mnt/media/samba/netlogon
  74.    read only = yes
  75.    browseable = no
  76.    public = no
  77.  
  78. [profiles]
  79.    comment = User profiles
  80.    path = /mnt/media/samba/profiles
  81.    writeable = yes
  82.    browseable = no
  83.    public = no
  84.    csc policy = disable
  85.    create mask = 0600
  86.    directory mask = 0700
  87.  
  88. [homes]
  89.    comment = Home Directories
  90.    browseable = no
  91.    writable = yes
  92.    force create mode = 0640
  93.    force directory mode = 0750
  94.  
  95. # NOTE: If you have a BSD-style print system there is no need to
  96. # specifically define each individual printer
  97. [printers]
  98.    comment = All Printers
  99.    path = /var/spool/samba
  100.    browseable = no
  101. # Set public = yes to allow user 'guest account' to print
  102.    guest ok = no
  103.    writable = no
  104.    printable = yes
  105.  
  106. [Video]
  107.    comment = Video
  108.    path = /mnt/media/samba/video
  109.    browseable = yes
  110.    public = no
  111.    writable = yes
  112.    force create mode  = 0640
  113.    force directory mode = 0750
  114.    create mask = 0640
  115.    directory mask = 0750
  116.    force user = root
  117.    force group = wheel
  118.    valid users = @smb_video_read, @smb_video_write
  119.    write list = @smb_video_write
  120.    read list = @smb_video_read, @smb_video_write
  121.  
  122. [Music]
  123.    comment = Music
  124.    path = /mnt/media/samba/music
  125.    browseable = yes
  126.    public = no
  127.    writable = yes
  128.    force create mode = 0640
  129.    force directory mode = 0750
  130.    create mask = 0640
  131.    directory mask = 0750
  132.    force user = root
  133.    force group = wheel
  134.    valid users = @smb_music_read, @smb_music_write
  135.    write list = @smb_music_write
  136.    read list = @smb_music_read, @smb_music_write
  137.  
  138. [Distrib]
  139.    comment = Distrib
  140.    path = /mnt/media/samba/distrib
  141.    browseable = yes
  142.    public = no
  143.    writable = yes
  144.    force create mode = 0640
  145.    force directory mode = 0750
  146.    create mask = 0640
  147.    directory mask = 0750
  148.    force user = root
  149.    force group = wheel
  150.    valid users = @smb_distrib_read, @smb_distrib_write
  151.    write list = @smb_distrib_write
  152.    read list = @smb_distrib_read, @smb_distrib_write
  153.  
  154. [Wallpapers]
  155.    comment = Wallpapers
  156.    path = /mnt/media/samba/wallpapers
  157.    browseable = yes
  158.    public = no
  159.    writable = yes
  160.    force create mode = 0640
  161.    force directory mode = 0750
  162.    create mask = 0640
  163.    directory mask = 0750
  164.    force user = root
  165.    force group = wheel
  166.    valid users = @smb_wallpapers_read, @smb_wallpapers_write
  167.    write list = @smb_wallpapers_write
  168.    read list = @smb_wallpapers_read, @smb_wallpapers_write
Теперь нужно сказать пароль самбе от главного пользователя лдапа:
  1. # smbpasswd -W
  2. Enter password: ***
  3. Retype enter password: ***
Добавляем самбу в автозагрузку и запускаем.
  1. # echo 'smbd_enable="YES"' >> /etc/rc.conf
  2. # echo 'nmbd_enable="YES"' >> /etc/rc.conf
  3. # service samba start
Проверим, запустилась ли samba:
  1. # sockstat | grep -E "smbd|nmbd"
  2. root     smbd       18247 10 tcp4   192.168.7.250:139     192.168.7.101:2386
  3. root     smbd       18247 21 tcp4   127.0.0.1:61042       127.0.0.1:389
  4. root     smbd       18247 25 tcp4   127.0.0.1:62217       127.0.0.1:389
  5. root     smbd       92555 21 tcp4   127.0.0.1:63357       127.0.0.1:389
  6. root     smbd       92553 21 tcp4   127.0.0.1:63357       127.0.0.1:389
  7. root     smbd       92553 22 tcp4   127.0.0.1:445         *:*
  8. root     smbd       92553 23 tcp4   127.0.0.1:139         *:*
  9. root     smbd       92553 24 tcp4   192.168.7.250:445     *:*
  10. root     smbd       92553 25 tcp4   192.168.7.250:139     *:*
  11. root     nmbd       92548 11 udp4   *:137                 *:*
  12. root     nmbd       92548 12 udp4   *:138                 *:*
  13. root     nmbd       92548 13 udp4   192.168.7.250:137     *:*
  14. root     nmbd       92548 14 udp4   192.168.7.250:138     *:*
Если на экране вы видите что-то подобное, то запуск самбы прошел успешно. Создаем группы в системе, которым будут сопоставляться группы Windows.
  1. # ldapaddgroup smb_pdc_admins
  2. # ldapaddgroup smb_pdc_users
  3. # ldapaddgroup smb_pdc_computers
  4. # ldapaddgroup smb_pdc_guests
Далее нужно сопоставить группы винды группам системы:
  1. # net groupmap add rid=512 unixgroup=smb_pdc_admins type=d ntgroup="Domain Admins"
  2. # net groupmap add rid=513 unixgroup=smb_pdc_users type=domain ntgroup="Domain Users"
  3. # net groupmap add rid=514 unixgroup=smb_pdc_guests type=domain ntgroup="Domain Guests"
  4. # net groupmap add rid=515 unixgroup=smb_pdc_computers type=domain ntgroup="Domain Computers"
Посмотрим, что получилось:
  1. # net groupmap list
  2. Domain Admins (S-1-5-21-2073026716-1291088168-25512215-512) -> smb_pdc_admins
  3. Domain Users (S-1-5-21-2073026716-1291088168-25512215-513) -> smb_pdc_users
  4. Domain Computers (S-1-5-21-2073026716-1291088168-25512215-515) -> smb_pdc_computers
  5. Domain Guests (S-1-5-21-2073026716-1291088168-25512215-514) -> smb_pdc_guests
Для разграничения прав к шарам я указал группы, которым разрешены либо чтение, либо запись. Их тоже нужно создать и сопоставить им виндовые группы:
  1. # ldapaddgroup smb_video_read
  2. # ldapaddgroup smb_video_write
  3. # ldapaddgroup smb_music_read
  4. # ldapaddgroup smb_music_write
  5. # ldapaddgroup smb_distrib_read
  6. # ldapaddgroup smb_distrib_write
  7. # ldapaddgroup smb_wallpapers_read
  8. # ldapaddgroup smb_wallpapers_write
  9.  
  10. # net groupmap add unixgroup=smb_video_read type=local ntgroup="Video Share Read"
  11. # net groupmap add unixgroup=smb_video_write type=local ntgroup="Video Share Write"
  12. # net groupmap add unixgroup=smb_music_read type=local ntgroup="Music Share Read"
  13. # net groupmap add unixgroup=smb_music_write type=local ntgroup="Music Share Write"
  14. # net groupmap add unixgroup=smb_distrib_read type=local ntgroup="Distrib Share Read"
  15. # net groupmap add unixgroup=smb_distrib_write type=local ntgroup="Distrib Share Write"
  16. # net groupmap add unixgroup=smb_wallpapers_read type=local ntgroup="Wallpapers Share Read"
  17. # net groupmap add unixgroup=smb_wallpapers_write type=local ntgroup="Wallpapers Share Write"
Создаем администратора домена:
  1. # ldapadduser nekit smb_pdc_admins
  2. # smbpasswd -a nekit
  3. New password: ***
  4. Retype password: ***
Еще нужно дать группе или пользователю права на включение машин в домен и другие:
  1. # net rpc rights grant "Domain Admins" SeMachineAccountPrivilege -U nekit
  2. # net rpc rights grant "Domain Admins" SeTakeOwnershipPrivilege -U nekit
  3. # net rpc rights grant "Domain Admins" SeBackupPrivilege -U nekit
  4. # net rpc rights grant "Domain Admins" SeRestorePrivilege -U nekit
  5. # net rpc rights grant "Domain Admins" SeRemoteShutdownPrivilege -U nekit
  6. # net rpc rights grant "Domain Admins" SePrintOperatorPrivilege -U nekit
  7. # net rpc rights grant "Domain Admins" SeAddUsersPrivilege -U nekit
  8. # net rpc rights grant "Domain Admins" SeDiskOperatorPrivilege -U nekit
В принципе настройка контроллера домена закончена и можно включать компы в него. Для удобства администрирования пользователями и компами в домене NT4 есть утилиты от мелкософта srvtools. Так же если вы будете назначать групповые политики через файл NTconfig.pol, то понадобится тулза poledit и шаблоны для определенной версии винды (Windows 2000, Windows XP). Все утилиты были взяты из дистра винды NT4, а шаблоны берутся из серверной винды. На этом все, пользуемся...
Прикрепленные файлы

вт, 10/11/2020 - 13:27

вт, 10/11/2020 - 23:00

пт, 13/11/2020 - 18:46

сб, 14/11/2020 - 10:26

Добавить комментарий

Этот вопрос задается для того, чтобы выяснить, являетесь ли Вы человеком или представляете из себя автоматическую спам-рассылку.