To begin, obviously you should NOT be doing this on a production server or workstation. Also it's important to note that everyones domain is slightly different, so if this solution does not work 100% for your domain, you may just need to tweak one of the config files below. DON'T GIVE UP, enterprises bind active directories to linux, WE bind Active Directories to linux, IT CAN BE DONE.
To begin, I will be using the domain "example.name.domain" in place of the full domain name, EXAMPLE in place of the short name. A common mistake people will make when attempting this the first time is to not pay attention to the case. It's important that where UPPERCASE is used, you use uppercase. Also I use "computername" in place of the computers name, it's also important that case and spelling remain exactly the same across all of the configuration files. Last I use "xxx" in place of the numeric value of any IP address.
For ubuntu users, you MAY need to add the Universe and Multiverse repositories first: (Debian users can skipo to "Update The Package list")
sudo nano /etc/apt/sources.list # deb http://us.archive.ubuntu.com/ubuntu/ edgy universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ edgy universe deb http://us.archive.ubuntu.com/ubuntu/ edgy main restricted <strong>universe multiverse</strong>
deb-src http://us.archive.ubuntu.com/ubuntu/ edgy main restricted <strong>universe multiverse</strong> deb http://security.ubuntu.com/ubuntu edgy-security main restricted <strong>universe</strong>
deb-src http://security.ubuntu.com/ubuntu edgy-security main restricted <strong>universe</strong>
Update the package lists
sudo apt-get updatesudo apt-get upgradesudo apt-get install krb5-user winbind samba ntpdatesudo ntpdate pool.ntp.orgConfigure the /etc/krb5.conf file
Use the following command to open and edit the filesudo nano /etc/krb5.conf [libdefaults]
default_realm = <strong>EXAMPLE.NAME.DOMAIN</strong>
ticket_lifetime = 24000
default_tkt_enctypes = des3-hmac-sha1 des-cbc-crc
default_tgs_enctypes = des3-hmac-sha1 des-cbc-crc
[realms]
<strong>EXAMPLE.NAME.DOMAIN = {
kdc = EXAMPLE.NAME.DOMAIN
default_domain = EXAMPLE.NAME.DOMAIN}</strong>
[domain_realm]
.mit.edu = ATHENA.MIT.EDU
mit.edu = ATHENA.MIT.EDU
.media.mit.edu = MEDIA-LAB.MIT.EDU
media.mit.edu = MEDIA-LAB.MIT.EDU
.whoi.edu = ATHENA.MIT.EDU
whoi.edu = ATHENA.MIT.EDU
.stanford.edu = stanford.edu
<strong>.example.name.domain = EXAMPLE.NAME.DOMAIN</strong>
<strong>example.name.domain = EXAMPLE.NAME.DOMAIN</strong>Configure the /etc/samba/smb.conf file
Change the following line# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup = MSHOME[global]
workgroup = <strong>EXAMPLE</strong>
realm = <strong>EXAMPLE.NAME.DOMAIN</strong>
server string = <strong>computername</strong>
security = ADS
obey pam restrictions = Yes
password server = <strong>EXAMPLE.NAME.DOMAIN</strong>
passdb backend = tdbsam
restrict anonymous = 2
log level = 2
log file = /var/log/samba/%m
printcap name = cups
local master = No
domain master = No
idmap uid = 10000-10000000
idmap gid = 10000-10000000
template shell = /bin/bash
winbind separator = +
winbind use default domain = Yes
cups options = raw
socket options = TCP_NODELAY TCP_NODELAY SO_SNDBUF=8192 SO_RCVBUF=8192 IPTOS_LOWDELAY
encrypt passwords = yes
invalid users = root
acl check permissions = no
unix extensions = novalid users = %SEdit /etc/nsswitch.conf
The file should look the example below.passwd: files winbind
group: files winbind
shadow: compat
hosts: files dns wins
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis Modify the PAM settings
/etc/pam.d/common-account should contain only the following linesaccount sufficient pam_winbind.so
account required pam_unix.so
auth sufficient pam_winbind.so
auth required pam_unix.so nullok_secure use_first_pass debug
password required pam_unix.so nullok obscure min=4 max=50 md5#session optional pam_foreground.so
session required pam_mkhomedir.so umask=0022 skel=/etc/skel
auth required /lib/security/pam_winbind.so
account required /lib/security/pam_winbind.so
Make a directory to hold domain user home directories
sudo mkdir /home/EXAMPLEModify the host file
The top of /etc/hosts should read: Note that xxx should be replaced with a DNS name in domaincat /etc/hosts
127.0.0.1 localhost
127.0.1.1 computername.example.name.domain computername
127.0.1.1 computername.example.name.domain localhost computername
xxx.xxx.xxx.xxx EXAMPLE.NAME.DOMAIN EXAMPLEResolv.conf
This is a critical step, make sure that the machine is allowed to point to the correct Ldap dns servers or you will get an error when you bind to the ADS. search example.name.domain
nameserver xxx.xxx.xxx.xxxC:\ipconfig /allTest the DNS lookup
Replace machine_name with a DNS name of a server or workstation on your network nslookup machine_name Server: xxx.xxx.xxx.xxx
Address: xxx.xxx.xxx.xxx
Name: machine_name.example.name.domain
Address: xxx.xxx.xxx.xxx
Test your FQDN
hostname -a hostname -f The above command will result in the following format: computer name.example.name.domain
If this does not work, go back and check your hosts file
Initialize Kerberos
kinit domain_admin_accountA domain admin is anyone that can control the users container, this is basically a user that could add or remove users or objects to the domain, if you can't do this, ask your AD administrator to do this step for you.
Enter the password for the user, if nothing comes back after you type it in, your good, otherwise re-review the above steps.
Next check to be sure you got a ticket from the domain controller:
klistJoin the system to the domain
sudo net ads join -U <strong>username</strong>@EXAMPLE.NAME.DOMAINRestart Samba
Order is importantsudo /etc/init.d/samba stop;sudo /etc/init.d/winbind restart;sudo /etc/init.d/samba startRestart SSH and Test Connectivity
sudo /etc/init.d/ssh restartProblems
If when logging into the machine one gets a "no logon servers" error winbind\samba may not be starting properly. Try restarting them manually, and then logging in. Another issue, the name service cache daemon (nscd) can interfere with winbind, as winbind maintains its own cache. Remove it.sudo apt-get remove nscdSome names or groups are not resolved with getent, but others are not
The range of your idmap parameter is not wide enough to encompass all the users or groups
idmap uid = 16777216-33554431
idmap gid = 16777216-33554431