DISCLAIMER: This entry is almost an integral copy of this post on the Ubuntu Forums, so let’s give the credit where is due and I give a huge THANKS to tfiedler. Now, why am I doing this? The reason is simple: I’m using this blog as a scratchbook/memo/notepad so if one day I’m going to need again this howto, I will know for sure where to find it easily. Moreover I will cover more in depth a couple of points so… let’s go!
- Install the required packages with all their dependencies:
apt-get install krb5-user
apt-get install winbind samba
Note: you have to enable the Universe repository in your Ubuntu configuration (edit your /etc/apt/sources.list) or you will not find krb5-user - Edit /etc/krb5.conf to look exactly like this, no more, no less. Only change the $VARIABLES with your real names:
[logging]
default = FILE10000:/var/log/krb5lib.log
[libdefaults]
ticket_lifetime = 24000
default_realm = $FQDN_OF_YOUR_DOMAIN
default_tkt_enctypes = des3-hmac-sha1 des-cbc-crc
default_tgs_enctypes = des3-hmac-sha1 des-cbc-crc
[realms]
$FQDN_OF_YOUR_DOMAIN = {
kdc = $FQDN_OF_YOUR_DC
admin_server = $FQDN_OF_YOUR_DC
default_domain = $FQDN_OF_YOUR_DOMAIN
}
[domain_realm]
.domain.internal = $FQDN_OF_YOUR_DOMAIN
domain.internal = $FQDN_OF_YOUR_DOMAIN
moreover, remember that $FQDN_OF_YOUR_DOMAIN should be in capitals. - Edit /etc/samba/smb.conf to look like this (you will need to add your shares after this):
[global]
security = ads
netbios name = $NETBIOS_NAME_OF_YOUR_UBUNTU_BOX
realm = $FQDN_OF_YOUR_DOMAIN
password server = $FQDN_OF_YOUR_DC
workgroup = $NETBIOS_NAME_OF_YOUR_DOMAIN
idmap uid = 500-10000000
idmap gid = 500-10000000
winbind separator = +
winbind enum users = no
winbind enum groups = no
winbind use default domain = yes
template homedir = /home/%D/%U
template shell = /bin/bash
client use spnego = yes
domain master = no - Edit /etc/nsswitch.conf to look exactly like this, no more, no less:
passwd: compat winbind
group: compat winbind
shadow: compat
hosts: files dns wins
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
- Edit PAM settings:
- /etc/pam.d/common-account should contain only the following lines:
account sufficient pam_winbind.so
account required pam_unix.so
- /etc/pam.d/common-auth should contain only the following lines:
auth sufficient pam_winbind.so
auth required pam_unix.so nullok_secure use_first_pass - Modify the /etc/pam.d/common-password file, so the max parameter is set to 50, similar to the one shown below:
password required pam_unix.so nullok obscure min=4 max=50 md5
- Make sure the /etc/pam.d/common-session file contains the following line:
session required pam_mkhomedir.so umask=0022 skel=/etc/skel
- /etc/pam.d/common-account should contain only the following lines:
- Now, let’s create the base home dir for the AD users:
mkdir -p /home/$NETBIOS_NAME_OF_YOUR_DOMAIN
- Initiliaze Kerberos:
kinit Administrator@$FQDN_OF_YOUR_DOMAIN
Note: write $FQDN_OF_YOUR_DOMAIN in capitals as you did in your krb5.conf file.You can check you’ve obtained your ticket withklist
- Join the system to the AD:
net ads join -U Adminstrator@$FQDN_OF_YOUR_DOMAIN
- Restart these services in order:
/etc/init.d/samba stop
/etc/init.d/winbind stop
/etc/init.d/samba start
/etc/init.d/winbind start - Restart ssh
/etc/init.d/ssh restart
and test it (it should work fine!)ssh $ad_user@$FQDN_OF_YOUR_UBUNTU_BOX
That’s all!
wow, great articles!, thanks for sharing =).
regards…
Thanks to you for your feedback :)
Very nice, I have followed other tutorials that were much more complex, yet didn’t quite work, yours worked first pass.
This is very perfect. It fully works for me.
[…] authentication in Ubuntu 8.04 Posted on April 6, 2008 by Vide This is a second version of this other guide that applied to previous Ubuntu versions. With Ubuntu 8.04 it comes the Likewise Open package that […]
[…] Este procedimento não seria possível sem as fontes abaixo: http://wiki.ubuntubrasil.org/AutenticandoAD https://anothersysadmin.wordpress.com/2007/08/03/active-directoy-authentication-with-ubuntu/ […]
Can any body tell me if we can put two password servers in smb.conf configuration as explained above. I need to add two DC for fail-safe purposes.
[…] This is how I added them to AD: https://anothersysadmin.wordpress.com/2007/08/03/active-directoy-authentication-with-ubuntu/ […]
I have issue with installing krb5-user in my ubuntu 1.6 version…….
I really appreciate if you can help me out with that,, since i have been struggling with tht problem for a long time..
email me your reply at
: anisalimomin@hotmail.com
thanks:
Anis