{"id":356,"date":"2010-05-24T15:59:19","date_gmt":"2010-05-24T22:59:19","guid":{"rendered":"http:\/\/jim-zimmerman.com\/?p=356"},"modified":"2012-01-20T10:22:18","modified_gmt":"2012-01-20T17:22:18","slug":"howto-join-an-active-directory-server-using-rhel5-xcentos5-x-and-samba-3-0-x","status":"publish","type":"post","link":"https:\/\/jim-zimmerman.com\/?p=356","title":{"rendered":"Howto Join An Active Directory Server using  RHEL5.x\/CentOS5.x and Samba 3.0.x"},"content":{"rendered":"<p>I used the following procedure to join a simple Windows 2003 Active Directory.  <\/p>\n<p>Ensure that your time is synced with the ADS machines via ntp.conf.<\/p>\n<p>I used the following to sync time to my NTP server:<br \/>\n# cat \/etc\/ntp.conf<br \/>\nrestrict default kod nomodify notrap nopeer noquery<\/p>\n<p>restrict 127.0.0.1<br \/>\nrestrict -6 ::1<\/p>\n<p>server 127.127.1.0<br \/>\nfudge   127.127.1.0 stratum 10<\/p>\n<p>driftfile \/var\/lib\/ntp\/drift<\/p>\n<p>keys \/etc\/ntp\/keys<\/p>\n<p>server ntp.domain.com<br \/>\nrestrict ntp.domain.com mask 255.255.255.255 nomodify notrap noquery<\/p>\n<p>Ensure that your name resolution is configured properly.  If needed, modify via \/etc\/sysconfig\/network with the fully qualified name.  Also, the \/etc\/resolv.conf should use the same DNS servers that handle the dynamic updates for the ADS domain.<\/p>\n<p>For example:<br \/>\n# hostname<br \/>\nrhel5.domain.local<\/p>\n<p># cat \/etc\/resolv.conf<br \/>\nsearch domain.local<br \/>\nnameserver 192.168.0.31<br \/>\nnameserver 192.168.0.32<\/p>\n<p>Configure kerberos:<\/p>\n<p>For example:<br \/>\n# cat \/etc\/krb5.conf<br \/>\n[logging]<br \/>\n default = FILE:\/var\/log\/krb5libs.log<br \/>\n kdc = FILE:\/var\/log\/krb5kdc.log<br \/>\n admin_server = FILE:\/var\/log\/kadmind.log<\/p>\n<p>[libdefaults]<br \/>\n default_realm = DOMAIN.LOCAL<br \/>\n dns_lookup_realm = false<br \/>\n dns_lookup_kdc = false<br \/>\n ticket_lifetime = 24h<br \/>\n forwardable = yes<\/p>\n<p>[realms]<br \/>\n DOMAIN.LOCAL = {<br \/>\n  kdc = pdc.domain.local:88<br \/>\n  admin_server = pdc.domain.local:749<br \/>\n  default_domain = domain.local<br \/>\n }<\/p>\n<p>[domain_realm]<br \/>\n .domain.local = DOMAIN.LOCAL<br \/>\n domain.local = DOMAIN.LOCAL<\/p>\n<p>[appdefaults]<br \/>\n pam = {<br \/>\n   debug = false<br \/>\n   ticket_lifetime = 36000<br \/>\n   renew_lifetime = 36000<br \/>\n   forwardable = true<br \/>\n   krb4_convert = false<br \/>\n }<\/p>\n<p>Test kerberos:<br \/>\nkinit -V administrator@DOMAIN.LOCAL<\/p>\n<p>You should get the following kind of output:<br \/>\nAuthenticated to Kerberos v5<\/p>\n<p>Configure samba:<br \/>\n# cat \/etc\/samba\/smb.conf<br \/>\n#GLOBAL PARAMETERS<br \/>\n[global]<br \/>\n   workgroup = DOMAIN<br \/>\n   realm = DOMAIN.LOCAL<br \/>\n   preferred master = no<br \/>\n   server string = Linux Test Machine<br \/>\n   security = ADS<br \/>\n   encrypt passwords = yes<br \/>\n   log level = 3<br \/>\n   log file = \/var\/log\/samba\/%m<br \/>\n   max log size = 50<br \/>\n   printcap name = cups<br \/>\n   printing = cups<br \/>\n   winbind enum users = Yes<br \/>\n   winbind enum groups = Yes<br \/>\n   winbind use default domain = Yes<br \/>\n   winbind nested groups = Yes<br \/>\n   winbind separator = +<br \/>\n   idmap uid = 600-200000<br \/>\n   idmap gid = 600-200000<br \/>\n   ;template primary group = &#8220;Domain Users&#8221;<br \/>\n   template shell = \/bin\/bash<\/p>\n<p>[homes]<br \/>\n   comment = Home Direcotries<br \/>\n   valid users = %S<br \/>\n   read only = No<br \/>\n   browseable = No<\/p>\n<p>[printers]<br \/>\n   comment = All Printers<br \/>\n   path = \/var\/spool\/cups<br \/>\n   browseable = no<br \/>\n   printable = yes<br \/>\n   guest ok = yes<\/p>\n<p>Use the testparm command to verify your samba configuration:<br \/>\n# testparm<br \/>\nLoad smb config files from \/etc\/samba\/smb.conf<br \/>\nProcessing section &#8220;[homes]&#8221;<br \/>\nProcessing section &#8220;[printers]&#8221;<br \/>\nLoaded services file OK.<br \/>\n&#8216;winbind separator = +&#8217; might cause problems with group membership.<br \/>\nServer role: ROLE_DOMAIN_MEMBER<br \/>\nPress enter to see a dump of your service definitions<br \/>\n&#8230;<\/p>\n<p>Join the domain:<br \/>\nnet ads join -U administrator<\/p>\n<p>You will be prompted for the administrator password.  If successful a message will be displayed stating as such.<br \/>\nFor example:<br \/>\nUsing short domain name \u00e2\u20ac\u201c DOMAIN<\/p>\n<p>Joined &#8216;RHEL5&#8217; to realm &#8216;domain&#8217;<\/p>\n<p>From here you can execute several commands to test:<\/p>\n<p># net ads testjoin DOMAIN<br \/>\nJoin is OK<\/p>\n<p>Start up the samba related services:<\/p>\n<p># service smb start<br \/>\n# service winbind start<\/p>\n<p>The following will list both local user IDs and ADS user IDs:<br \/>\n# wbinfo -u<\/p>\n<p>The will list ADS group names:<br \/>\n# wbinfo -g<\/p>\n<p>The following will verify ADS authentication (In this example, \u00e2\u20ac\u0153password\u00e2\u20ac\u009d is the administrator account password.):<br \/>\n# wbinfo -a administrator%password<br \/>\nplaintext password authentication succeeded<br \/>\nchallenge\/response password authentication succeeded<\/p>\n<p>Modify nsswitch.conf to support ADS authentication:<br \/>\n# cat \/etc\/nsswitch.conf<br \/>\npasswd:     files winbind<br \/>\nshadow:     files winbind<br \/>\ngroup:      files winbind<br \/>\nhosts:      files dns<br \/>\nbootparams: nisplus [NOTFOUND=return] files<br \/>\nethers:     files<br \/>\nnetmasks:   files<br \/>\nnetworks:   files<br \/>\nprotocols:  files<br \/>\nrpc:        files<br \/>\nservices:   files<br \/>\nnetgroup:   nisplus<br \/>\npublickey:  nisplus<br \/>\nautomount:  files nisplus<br \/>\naliases:    files nisplus<\/p>\n<p>This is very important.  Make sure you are logged into a couple virtual terminals as root in case there is a problem.  You can end up locking yourself out.<\/p>\n<p>Make a backup copy of \/etc\/pam.d\/system-auth-ac:<br \/>\n# cd \/etc\/pam.d<br \/>\n# cp -rp system-auth-ac system-auth-ac.orig<\/p>\n<p>Edit the system-auth-ac file:<br \/>\n# cat \/etc\/pam.d\/system-auth-ac<br \/>\n#%PAM-1.0<br \/>\nauth        required      pam_env.so<br \/>\nauth        sufficient    pam_unix.so likeauth nullok<br \/>\nauth        sufficient    pam_winbind.so use_first_pass<br \/>\nauth        required      pam_deny.so<\/p>\n<p>account     required      pam_unix.so<br \/>\naccount     sufficient    pam_succeed_if.so uid < 100 quiet\naccount     sufficient    pam_winbind.so use_first_pass\naccount     required      pam_permit.so\n\npassword    requisite     pam_cracklib.so retry=3 type=\npassword    sufficient    pam_unix.so nullok use_authtok md5 shadow\npassword    sufficient    pam_winbind.so use_first_pass\npassword    required      pam_deny.so\n\nsession     required      pam_limits.so\nsession     required      pam_unix.so\nsession     required      pam_winbind.so use_first\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I used the following procedure to join a simple Windows 2003 Active Directory. Ensure that your time is synced with the ADS machines via ntp.conf. I used the following to sync time to my NTP server: # cat \/etc\/ntp.conf restrict default kod nomodify notrap nopeer noquery restrict 127.0.0.1 restrict -6 ::1 server 127.127.1.0 fudge 127.127.1.0 [&#038;hellip<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[82,83,85,48,84,61],"class_list":["post-356","post","type-post","status-publish","format-standard","hentry","category-documentation","tag-active-directory","tag-ads","tag-join","tag-linux","tag-rhel","tag-samba"],"share_on_mastodon":{"url":"","error":""},"_links":{"self":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/356","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=356"}],"version-history":[{"count":3,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/356\/revisions"}],"predecessor-version":[{"id":677,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/356\/revisions\/677"}],"wp:attachment":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}