Posts Tagged ‘Active Directory’

  • Install the required packages:

yum install samba krb5-workstation krb5-libs pam_krb5 samba-common ntp

  • Edit /etc/krb5.conf (and replace the entries in bold, do not use the <> symbols!):

[logging]
 default = FILE:/var/log/krb5libs.log
 kdc = FILE:/var/log/krb5kdc.log
 admin_server = FILE:/var/log/kadmind.log
  
[libdefaults]
 default_realm = <DOMAIN.LOCAL>
 dns_lookup_realm = true
 dns_lookup_kdc = true
 ticket_lifetime = 24h
 forwardable = yes
  
[realms]
 <DOMAIN.LOCAL> = {
 kdc = <domain-controller.domain.local>
 admin_server = <domain-controller.domain.local>

 default_domain = <DOMAIN.LOCAL>
 }
  
[domain_realm]
 .<domain.local> = <DOMAIN.LOCAL>
 <domain.local><DOMAIN.LOCAL>
  
[appdefaults]
 pam = {
 debug = false
 ticket_lifetime = 36000
 renew_lifetime = 36000
 forwardable = true
 krb4_convert = false
 }

  • Edit /etc/samba/smb.conf [global] section (again replace the entries in bold and do not use with <> symbols):

[global]
  
 workgroup = <DOMAIN>
 netbios name = <COMPUTER-HOST-NAME>
 server string = <Computer Description>
 security = ads
 realm = <DOMAIN.LOCAL>
 encrypt passwords = yes
 smb passwd file = /etc/samba/smbpasswd
 allow trusted domains = yes
 unix password sync = Yes
 passwd program = /usr/bin/passwd %u
 passwd chat = *New*password* %n\n *Retype*new*password* %n\n*passwd:*all*authentication*tokens*updated*successfully*
 pam password change = yes
 obey pam restrictions = yes
 socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
 dns proxy = no
 idmap uid = 16777216-33554431
 idmap gid = 16777216-33554431
 winbind use default domain = yes
 # winbind separator = #
 winbind enum users = yes
 winbind enum groups = yes
 template shell = /bin/bash
 template homedir = /home/%U
 load printers = no
 printing = none
 printcap name = /dev/null
 disable spoolss = yes

Note: I don’t like to use the winbind separator feature because I like my domain accounts to authenticate without having to use something like DOMAIN\username or DOMAIN+username to login to the Linux shell. This is up to you. Same with the HOMEDIR location, I like the users to remain within the /home directory rather than /home/DOMAIN/

  • Edit /etc/nsswitch.conf:

passwd:     files winbind
shadow:     files winbind
group:      files winbind
hosts:      files dns

  •  Edit /etc/pam.d/system-auth:

auth required pam_env.so
auth sufficient pam_unix.so likeauth nullok
auth sufficient pam_krb5.so use_first_pass
auth sufficient pam_winbind.so use_first_pass
auth required pam_deny.so
  
account required pam_unix.so broken_shadow
account sufficient pam_succeed_if.so uid < 100 quiet
account [default=bad success=ok user_unknown=ignore] pam_krb5.so
account [default=bad success=ok user_unknown=ignore]pam_winbind.so
account required pam_permit.so
  
# Use option below if you want to restrict all users but
# those that belong to the ‘unix’ group in AD
# account requisite pam_succeed_if.so user ingroup unix
  
password requisite pam_cracklib.so retry=3
password sufficient pam_unix.so nullok use_authtok md5 shadow
password sufficient pam_krb5.so use_authtok
password sufficient pam_winbind.so use_authtok
password required pam_deny.so
  
session required pam_limits.so
session required pam_unix.so
session optional pam_mkhomedir.so skel=etc/skel/ umask=0027
session optional pam_krb5.so

  • Once these files are added, you need to turn on winbind manually for the test: 

 /etc/init.d/winbind restart ; /etc/init.d/smb restart

  • Ensure winbind and Samba are running in the proper run levels:

chkconfig –level 345 winbind on ; chkconfig –level 345 smb on

  • You will now want to try to add the computer to the domain. You will need an account with domain admin privileges to do this:

net ads join –U <administrator>@<DOMAIN LOCAL>

This will join the computer to the domain, and will prompt you for the administrator password. It should work successfully. If not, look at log files, conf files, and ensure they match this guide!

To see if you are able to see groups, just type in:

wbinfo –g

  • Other commands to try:

getent passwd (password list, should retrieve domain users as well)
getent group (group list, should retrieve domain groups as well)
wbinfo –g (lists groups from domain)
wbinfo –u  (lists users from domain)

Advertisements