Debian: Samba with AD Authentication
This tutorial is a mix-up of other tutorials I found on the net. You’ll find the other sites in the source list at the bottom of this post.Remember:
Just change ICT-FREAK.LOCAL to your own domain and Debian5srv1 to the name of your Debian server.
Step 1: Update / Upgrade your Debain setup
apt-get update && apt-get upgradeStep 2: Install the following packages:
apt-get install krb5-config krb5-user libkrb53 libpam-krb5Step 3: Create a backup of the krb5.conf file.
samba-common samba winbind smbclient
mv /etc/krb5.conf /etc/krb5.conf.org
edit the /etc/krb5.conf file with you favorite editor (nano or vi /etc/krb5.conf):
[logging]Step 4: Check if you can Authenticate a user against the Active Directory
default = FILE:/var/log/krb5.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmin.log
[libdefaults]
default_realm = ICT-FREAK.LOCAL
dns_lookup_realm = false
dns_lookup_kdc = false
clock_skew = 300
ticket_lifetime = 24h
forwardable = yes
[realms]
ICT-FREAK.LOCAL = {
kdc = dc01.ICT-FREAK.LOCAL
admin_server = dc01.ICT-FREAK.LOCAL
default_domain = ICT-FREAK.LOCAL
}
debian5srv1:~# kinit administratorStep 5: Create a backup of the krb5.conf file.
Password for administrator@ICT-FREAK.LOCAL:
mv /etc/samba/smb.conf /etc/samba/smb.conf.org
edit the /etc/samba/smb.conf file with you favorite editor (nano or vi /etc/samba/smb.conf):
[global]Step 6: Start Winbind and test the connection
workgroup = ICT-FREAK
realm = ICT-FREAK.LOCAL
load printers = no
preferred master = no
local master = no
server string = fileserver
password server = <ip-address from your DC>
encrypt passwords = yes
security = ADS
netbios name = debian5srv1
client signing = Yes
dns proxy = No
wins server = <ip-address from your DC>
idmap uid = 10000-20000
idmap gid = 10000-20000
winbind separator = +
winbind enum users = Yes
winbind enum groups = Yes
winbind use default domain = Yes
auth methods = winbind
/etc/init.d/winbind startYou can query the AD with the command wbinfo. The –u parameter returns all users. The –g parameter returns all groups.
debian5srv1:~# wbinfo -u administratorStep 7: Add the Debian box to the Windows domain
guest
support_388945a0
krbtgt
debian5srv1:~# wbinfo -g BUILTIN+administrators
BUILTIN+users
helpservicesgroup
telnetclients
domain computers
domain controllers
schema admins
enterprise admins
cert publishers
domain admins
domain users
domain guests
group policy creator owners
ras and ias servers
dnsadmins
dnsupdateproxy
dhcp users
dhcp administrators
wins users
debian5srv1:~# kinit administratorStep 8: Now tell PAM that samba requires authentication and account from winbind. Add the following lines to /etc/pam.d/samba
Password for administrator@ICT-FREAK.LOCAL
debian5srv1:~# net ads join -U administrator
Joined ‘debian5srv1′ to realm ‘ICT-FREAK.LOCAL’
auth required /lib/security/pam_winbind.soWe also need to edit the /etc/nsswitch.conf file so it will look like this:
account required /lib/security/pam_winbind.so
passwd: compat winbindTest the new settings with: getent passwd If everything is configured as it should be, you’ll see the AD users.
group: compat winbind
shadow: compat
Step 9: Create a share. First we need to create a folder
mkdir –p /data/shareChange the permissions so the folder is writable
chmod 777 /data/shareOpen the /etc/samba/smb.conf file and paste the following lines:
[Share]Restart the Samba service via:
comment = Test Share
read only = no
path = /data/share
valid users = @"ICT-FREAK+domain users"
/etc/init.d/samba restartStep 10: Test the new share. Go to your Windows box and browse to the Debian box via \\debian5srv1
If everything is configured as it should be, you will see the following screen:
Sources:
http://www.simsonlai.org/samba-and-active-directory-authentication/
http://rubenleusink.com/debian-samba-filesharing-with-microsoft-active-directory-authentication-2008-10-07/
No comments:
Post a Comment