Single Sign-On and the Corporate Directory, Part III
Listing 3. LDIF for the Samba User
dn: uid=samba_server,ou=people,o=ci,dc=example,dc=com
objectClass: top
objectClass: person
objectClass: uidObject
sn: samba_server
cn: samba_server
userPassword: {SSHA}xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
uid: samba_server
Next, we need to tell Samba how to access the LDAP directory as samba_server user by using the smbpasswd command:
# /usr/bin/smbpasswd -w <password> Setting stored password for ↪"uid=samba_server,ou=people,o=ci,dc=example,dc=com" ↪in secrets.tdb
For added security, you should turn off your shell's history logging as the password is given on the command line. The smbpasswd command takes the password given and stores it in /var/lib/samba/private/secrets.tdb keyed to the Samba domain and the admin dn, so if either of those values change, you need to rerun smbpasswd.
Because Samba uses this user to query and modify values in the directory, we need to allow the Samba admin write access to certain attributes in the directory, so make sure to add the appropriate ACLs to /etc/openldap/slapd.conf.
At this point, we can get the SID for our domain. To obtain the domain's SID, you need to be root on the primary domain controller (PDC) for the domain, and run:
# net getlocalsid SID for domain CI-PDC is: ↪S-1-5-21-2162541494-3670296480-3949091320
If you won't be using the smbldap tools to create all of the Samba LDAP entries, you need to use this SID when creating those. I've included a sample LDIF containing all the entries you need to create in the on-line Resources.
Samba also needs a user with uid 0 in the LDAP directory temporarily to perform certain actions. The entry need not be a full posixAccount user, but it should look like Listing 4.
Listing 4. LDIF for root Account
dn: uid=root,ou=people,o=ci,dc=example,dc=com objectClass: account objectClass: sambaSamAccount cn: root uid: root displayName: root sambaSID: ↪S-1-5-21-2162541494-3670296480-3949091320-1000 sambaPrimaryGroupSID: ↪S-1-5-21-2162541494-3670296480-3949091320-512 sambaNTPassword: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx sambaAcctFlags: [U ] sambaLogonTime: 0 sambaLogoffTime: 2147483647 sambaKickoffTime: 2147483647
Notice that this user entry does have an NT password, but this password need not be the same as the actual root password, and it's only temporary to get rights assigned to normal users. I've included a simple Perl script in the on-line Resources that you can use to generate the NT password hashes that are needed. You need the Crypt::SmbHash and Term::ReadKey Perl modules to use it.
The last user to modify is your own, so that it's recognized as a Samba user and is a Domain Admin. Listing 5 shows the LDIF.
Listing 5. LDIF for Regular Samba User
dn: uid=leggett,ou=People,o=ci,dc=uchicago,dc=edu objectClass: top objectClass: inetOrgPerson objectClass: posixAccount objectClass: sambaSamAccount cn: Ti Leggett givenName: Ti sn: Leggett mail: leggett@mcs.anl.gov uid: leggett uidNumber: 1001 homeDirectory: /home/leggett loginShell: /bin/bash gidNumber: 1000 sambaSID: ↪S-1-5-21-2162541494-3670296480-3949091320-3002 sambaPrimaryGroupSID: ↪S-1-5-21-2162541494-3670296480-3949091320-512 sambaNTPassword: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx sambaAcctFlags: [U ] sambaLogonTime: 0 sambaLogoffTime: 2147483647 sambaKickoffTime: 2147483647
A Note about SIDs and RIDs
The SID for your domain is a unique key and is prepended to domain entities. The RID is a unique identifier for identities in the domain and is appended to the SID to make the sambaSID. The algorithm I follow to make sure RIDs are unique is to take the uid for a user, multiply it times 2 and add 1000. For groups, take the gid, multiply it times 2 and add 1001. This ensures that users all have even RIDs and groups have odd RIDs. The only exception to this rule are the Domain Admins, Domain Users and Domain Guests. The RIDs for these groups are the same as their gid for consistency with how Windows assigns them.
You'll notice that this account also has an NT password in the LDAP directory. Unfortunately, as of this writing, Samba has no stable support for using Kerberos authentication unless Samba is authenticating against an AD server. There are ways, however, to store Kerberos principal data in an LDAP directory if you're using the Heimdal Kerberos implementation. This potentially could make Samba authentication a little bit cleaner, though it won't make your Samba domain an AD server. Because we're not using Heimdal and this isn't officially supported, we must store Samba passwords in the directory. I've provided some links in the on-line Resources on the Kerberos/LDAP solution if you're interested.
We're now ready to start Samba, but make sure you also start the winbind service as well. Under Gentoo, modify /etc/conf.d/samba.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- Designing Electronics with Linux
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Dynamic DNS—an Object Lesson in Problem Solving
- New Products
- Using Salt Stack and Vagrant for Drupal Development
- Validate an E-Mail Address with PHP, the Right Way
- Build a Skype Server for Your Home Phone System
- Why Python?
- Tech Tip: Really Simple HTTP Server with Python
- A Topic for Discussion - Open Source Feature-Richness?
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




1 hour 4 min ago
4 hours 51 min ago
4 hours 59 min ago
7 hours 14 min ago
9 hours 43 min ago
19 hours 46 min ago
1 day 13 min ago
1 day 3 hours ago
1 day 4 hours ago
1 day 6 hours ago