A Windows network administrator explained in an email what changes he was planning to make and followed with the question: "Anyone done this before?" Many of us have upgraded and updated Samba without incident. Others have experienced much pain and user frustration. So it is to be hoped that the notes in this chapter will make a positive difference by assuring that someone will be saved a lot of discomfort.
Before anyone commences an upgrade or an update of Samba, the one cardinal rule that must be observed is: Backup all Samba configuration files in case it is necessary to revert to the old version. Even if you do not like this precautionary step, users will punish an administrator who fails to take adequate steps to avoid situations that may inflict lost productivity on them.
It is prudent also to backup all data files on the server before attempting to perform a major upgrade. Many administrators have experienced the consequences of failure to take adequate precautions. So what is adequate? That is simple! If data is lost during an upgrade or update and it can not be restored, the precautions taken were inadequate. If a backup was not needed, but was available, caution was on the side of the victor.
8.1.1. Cautions and Notes
Someone once said, "It is good to be sorry, but better never to need to be!" These are wise words of advice to those contemplating a Samba upgrade or update.
This is as good a time as any to define the terms upgrade and update. The term upgrade refers to the installation of a version of Samba that is a whole generation or more ahead of that which is installed. Generations are indicated by the first digit of the version number. So far Samba has been released in generations 1.x, 2.x, 3.x, and currently 4.0 is in development.
The term update refers to a minor version number installation in place of one of the same generation. For example, updating from Samba 3.0.10 to 3.0.14 is an update. The move from Samba 2.0.7 to 3.0.14 is an upgrade.
While the use of these terms is an exercise in semantics, what needs to be realized is that there are major functional differences between a Samba 2.x release and a Samba 3.0.x release. Such differences may require a significantly different approach to solving the same networking challenge and generally require careful review of the latest documentation to identify precisely how the new installation may need to be modified to preserve prior functionality.
There is an old axiom that says, "The greater the volume of the documentation, the greater the risk that noone will read it, but where there is no documentation, noone can read it!" While true, some documentation is an evil necessity. It is hoped that this update to the documentation will avoid both extremes.
22.214.171.124 Security Identifiers (SIDs)
Before the days of Windows NT and OS/2, every Windows and DOS networking client that used the SMB protocols was an entirely autonomous entity. There was no concept of a security identifier for a machine or a user outside of the username, the machine name, and the workgroup name. In actual fact, these were not security identifiers in the same context as the way that the SID is used since the development of Windows NT 3.10.
Versions of Samba prior to 1.9 did not make use of a SID. Instead they make exclusive use of the username that is embedded in the SessionSetUpAndX component of the connection setup process between a Windows client and an SMB/CIFS server.
Around November 1997 support was added to Samba-1.9 to handle the Windows security RPC-based protocols that implemented support for Samba to store a machine SID. This information was stored in a file called MACHINE.SID.
Within the lifetime of the early Samba 2.x series, the machine SID information was relocated into a tdb file called secrets.tdb, which is where it is still located in Samba 3.0.x along with other information that pertains to the local machine and its role within a domain security context.
There are two types of SID, those pertaining to the machine itself and the domain to which it may belong, and those pertaining to users and groups within the security context of the local machine, in the case of standalone servers (SAS) and domain member servers (DMS).
When the Samba smbd daemon is first started, if the secrets.tdb file does not exist, it is created at the first client connection attempt. If this file does exist, smbd checks that there is a machine SID (if it is a domain controller, it searches for the domain SID). If smbd does not find one for the current name of the machine or for the current name of the workgroup, a new SID will be generated and then written to the secrets.tdb file. The SID is generated in a nondeterminative manner. This means that each time it is generated for a particular combination of machine name (hostname) and domain name (workgroup), it will be different.
The SID is the key used by MS Windows networking for all networking operations. This means that when the machine or domain SID changes, all security-encoded objects such as profiles and ACLs may become unusable.
In Samba-3 on a domain controller (PDC or BDC), the domain name controls the domain SID. On all prior versions the hostname (computer name, or NetBIOS name) controlled the SID. On a standalone server the hostname still controls the SID.
The local machine SID can be backed up using this procedure (Samba-3):
root# net getlocalsid > /etc/samba/my-local-SID
The contents of the file /etc/samba/my-local-SID will be:
SID for domain FRODO is: S-1-5-21-726309263-4128913605-1168186429
This SID can be restored by executing:
root# net setlocalsid S-1-5-21-726309263-4128913605-1168186429
Samba 1.9.x stored the machine SID in the the file /etc/MACHINE.SID from which it could be recovered and stored into the secrets.tdb file using the procedure shown above.
Where the secrets.tdb file exists and a version of Samba 2.x or later has been used, there is no specific need to go through this update process. Samba-3 has the ability to read the older tdb file and to perform an in-situ update to the latest tdb format. This is not a reversible process it is a one-way upgrade.
In the course of the Samba 2.0.x series the smbpasswd was modified to permit the domain SID to be captured to the secrets.tdb file by executing:
root# smbpasswd -S PDC -Uadministrator%password
The release of the Samba 2.2.x series permitted the SID to be obtained by executing:
root# smbpasswd -S PDC -Uadministrator%password
from which the SID could be copied to a file and then written to the Samba-2.2.x secrets. tdb file by executing:
root# smbpasswd -W S-1-5-21-726309263-4128913605-1168186429
Domain security information, which includes the domain SID, can be obtained from Samba-2.2.x systems by executing:
root# rpcclient hostname lsaquery -Uroot%password
This can also be done with Samba-3 by executing:
root# net rpc info -Uroot%password Domain Name: MIDEARTH Domain SID: S-1-5-21-726309263-4128913605-1168186429 Sequence number: 1113415916 Num users: 4237 Num domain groups: 86 Num local groups: 0
It is a very good practice to store this SID information in a safely kept file, just in case it is ever needed at a later date.
Take note that the domain SID is used extensively in Samba. Where LDAP is used for the passdb backend, all user, group, and trust accounts are encoded with the domain SID. This means that if the domain SID changes for any reason, the entire Samba environment can become broken and require extensive corrective action if the original SID cannot be restored. Fortunately, it can be recovered from a dump of the LDAP database. A dump of the LDAP directory database can be obtained by executing:
root# slapcat -v -l filename.ldif
When the domain SID has changed, roaming profiles cease to be functional. The recovery of roaming profiles necessitates resetting of the domain portion of the user SID that owns the profile. This is encoded in the NTUser.DAT and can be updated using the Samba profiles utility. Please be aware that not all Linux distributions of the Samba RPMs include this essential utility. Please do not complain to the Samba Team if this utility is missing; that issue that must be addressed to the creator of the RPM package. The Samba Team do their best to make available all the tools needed to manage a Samba-based Windows networking environment.
126.96.36.199 Change of hostname
Samba uses two methods by which the primary NetBIOS machine name (also known as a computer name or the hostname) may be determined: If the smb.conf file contains a netbios name entry, its value will be used directly. In the absence of such an entry, the UNIX system hostname will be used.
Many sites have become victims of lost Samba functionality because the UNIX system hostname was changed for one reason or another. Such a change will cause a new machine SID to be generated. If this happens on a domain controller, it will also change the domain SID. These SIDs can be updated (restored) using the procedure outlined previously.
188.8.131.52 Change of Workgroup (Domain) Name
The domain name of a Samba server is identical to the workgroup name and is set in the smb.conf file using the workgroup parameter. This has been consistent throughout the history of Samba and across all versions.
Be aware that when the workgroup name is changed, a new SID will be generated. The old domain SID can be reset using the procedure outlined earlier in this chapter.
184.108.40.206 Location of config files
The Samba-Team has maintained a constant default location for all Samba control files throughout the life of the project. People who have produced binary packages of Samba have varied the location of the Samba control files. This has led to some confusion for network administrators.
The Samba 1.9.x smb.conf file may be found either in the /etc directory or in /usr/local/samba/lib.
During the life of the Samba 2.x release, the smb.conf file was relocated on Linux systems to the /etc/samba directory where it remains located also for Samba 3.0.x installations.
Samba 2.x introduced the secrets.tdb file that is also stored in the /etc/samba directory, or in the /usr/local/samba/lib directory subsystem.
The location at which smbd expects to find all configuration and control files is determined at the time of compilation of Samba. For versions of Samba prior to 3.0, one way to find the expected location of these files is to execute:
root# strings /usr/sbin/smbd | grep conf root# strings /usr/sbin/smbd | grep secret root# strings /usr/sbin/smbd | grep smbpasswd
Note: The smbd executable may be located in the path /usr/local/samba/sbin.
Samba-3 provides a neat new way to track the location of all control files as well as to find the compile-time options used as the Samba package was built. Here is how the dark secrets of the internals of the location of control files within Samba executables can be uncovered:
root# smbd -b | less Build environment: Built by: root@frodo Built on: Mon Apr 11 20:23:27 MDT 2005 Built using: gcc Build host: Linux frodo 2.6... SRCDIR: /usr/src/packages/BUILD/samba-3.0.20/source BUILDDIR: /usr/src/packages/BUILD/samba-3.0.20/source Paths: SBINDIR: /usr/sbin BINDIR: /usr/bin SWATDIR: /usr/share/samba/swat CONFIGFILE: /etc/samba/smb.conf LOGFILEBASE: /var/log/samba LMHOSTSFILE: /etc/samba/lmhosts LIBDIR: /usr/lib/samba SHLIBEXT: so LOCKDIR: /var/lib/samba PIDDIR: /var/run/samba SMB_PASSWD_FILE: /etc/samba/smbpasswd PRIVATE_DIR: /etc/samba ...
It is important that both the smb.conf file and the secrets.tdb be backed up before attempting any upgrade. The secrets.tdb file is version-encoded, and therefore a newer version may not work with an older version of Samba. A backup means that it is always possible to revert a failed or problematic upgrade.
220.127.116.11 International Language Support
Samba-2.x had no support for Unicode; instead, all national language character-set support in file names was done using particular locale codepage mapping techniques. Samba-3 supports Unicode in file names, thus providing true internationalization support.
Non-English users whose national language character set has special characters and who upgrade naively will find that many files that have the special characters in the file name will see them garbled and jumbled up. This typically happens with umlauts and accents because these characters were particular to the codepage that was in use with Samba-2.x using an 8-bit encoding scheme.
Files that are created with Samba-3 will use UTF-8 encoding. Should the file system ever end up with a mix of codepage (unix charset)-encoded file names and UTF-8-encoded file names, the mess will take some effort to set straight.
A very helpful tool is available from Bjorn Jacke's convmv work. Convmv is a tool that can be used to convert file and directory names from one encoding method to another. The most common use for this tool is to convert locale-encoded files to UTF-8 Unicode encoding.
18.104.22.168 Updates and Changes in Idealx smbldap-tools
The smbldap-tools have been maturing rapidly over the past year. With maturation comes change. The location of the smbldap.conf and the smbldap_bind.conf configuration files have been moved from the directory /etc/smbldap-tools to the new location of /etc/opt/IDEALX/smblda-tools directory.
The smbldap-tools maintains an entry in the LDAP directory in which it stores the next values that should be used for UID and GID allocation for POSIX accounts that are created using this tool. The DIT location of these values has changed recently. The original sambaUnixIdPooldn object entity was stored in a directory entry (DIT object) called NextFreeUnixId, this has been changed to the DIT object sambaDomainName. Anyone who updates from an older version to the current release should note that the information stored under NextFreeUnixId must now be relocated to the DIT object sambaDomainName.