Samba's Encrypted Password Support
The process of SMB-encrypted authentication is the same whether LanManager or NT encryption is being used. When a client indicates that it can support encrypted-password authentication during the protocol negotiation stage, the server will respond with a random 8-byte value known as the challenge. The challenge is different for each client request. The server stores the challenge until the client is authenticated or denied access.
After the client obtains the password from the user, it computes the hash value using one of the previously defined algorithms. The resulting 16-byte value is appended with 5 null bytes. This 21-byte value is used as three 56-bit DES keys to encrypt the 8-byte challenge value three times. The resulting 24-byte value is known as the response.
The server also executes the same algorithm, using the stored hashed password. If the value the server computes matches the value returned by the client, the client had to have known the password or at least the 16-byte hash value generated from the password. As a result, access will be granted as an authenticated user. Otherwise, access is denied. In either case, a plaintext password was not passed over the network, where it could be sniffed by an eavesdropper.
However, there is a snag with using this technique. Unlike the UNIX password hash, the SMB password hash is a password equivalent. This means that even though it isn't plaintext, it might as well be. It is the responsibility of the authentication client to accept a plaintext password and generate a hash before using it to encrypt the challenge from the server. Unfortunately, a custom client can be written that, rather than generating the password hash from a plaintext password, simply accepts a password hash and uses it to generate the appropriate response to the server. smbclient, a component of the Samba suite, can be modified to accomplish this task. To sum up, even though it is possible to crack the LanManager password in a reasonably short period of time, it isn't actually necessary to gain access to a share if you already know the password hash. The bottom line is that the Samba-encrypted-password file and the NT Security Accounts Manager (SAM) both contain sensitive information. Don't let the fact that it is “encrypted” lead you to believe that you don't have to protect it from snoopers.
Configuring Samba to use encrypted passwords is easy—just include this setting in the global section of your configuration file:
encrypt passwords = yes
Encrypted passwords work with all three security levels: share, user and server. Setting the security option to user or share requires that the Samba-encrypted-password file exist. If security is set to server, no further configuration is necessary, since all authentication requests will be passed off to a different SMB server. The server security option provides an easy way to integrate a Samba server into an existing NT domain. However, most installations of Samba will use user- or share-level security. The most common configuration is this:
security = user encrypt passwords = yesBoth the share and the user modes require the smbpasswd file, which contains the LanManager and NT password hashes for each user who will be accessing the Samba server.
The Samba-encrypted-password file, smbpasswd, is stored by default in /usr/local/samba/private. This directory is normally owned by root, with its permissions set to 500, so that only root can look at its contents. However, this configuration isn't strictly required—your smbpasswd file can be stored any place you wish. The Samba Red Hat package stores the smbpasswd file in the sensible location of /etc/smbpasswd. Wherever the smbpasswd file is stored, its permissions should be set to 600 (only user read and write) and it must be owned by root. It must not be possible for any user other than root to read this file.
Users can be added to the smbpasswd file in several ways. The best way is to use the smbpasswd -add command. For example,
smbpasswd -add jdblair foobar
will add an entry for jdblair with a password of foobar. When adding a user while the Samba server is running, this command must be used to ensure that the smbpasswd file is properly locked before it is modified.
Another way to create a new smbpasswd file is to use the mksmbpasswd.sh script that comes with Samba. This script is, oddly enough, stored in the /source subdirectory of the Samba distribution. For example:
cat /etc/passwd | mksmbpasswd.sh > \
/usr/local/samba/private/smbpasswd
If the system uses NIS, you should use this command:
ypcat passwd | mksmbpasswd.sh > \
/usr/local/samba/private/smbpasswd
After using the mksmbpasswd.sh script, edit the file by hand to
remove root, bin and daemon just to be on the safe side.
Finally, to allow users to update their encrypted password, set the permissions on smbpasswd to be setuid root as follows:
chmod u+s /usr/local/samba/bin/smbpasswd
The last problem to note is keeping the smbpasswd file synchronized with the default UNIX authentication method. If users access the UNIX machine only through the Samba server, this won't be a problem. However, most systems also allow users to access shell accounts, pop servers or other services that will authenticate using the default UNIX password file. Many techniques can help keep these two files in sync. A hacked version of the passwd command is available that will update both files at the same time. Many people use expect scripts to update a user's password, entering both the passwd and the smbpasswd command after prompting the user for a new password. Reportedly, a PAM module to handle updating almost transparently is in the works and may be available by the time this article is printed. Asking on the Samba mailing list (samba@samba.anu.edu.au) for solutions other people have cooked up to alleviate this problem can be a big timesaver.
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 |
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 16 min ago
10 hours 1 min ago
10 hours 35 min ago
11 hours 34 min ago
12 hours 24 min ago
16 hours 26 min ago
20 hours 13 min ago
20 hours 21 min ago
22 hours 36 min ago
1 day 1 hour ago