summaryrefslogtreecommitdiffstats
path: root/docs-xml/Samba3-HOWTO/TOSHARG-TDBFiles.xml
blob: 19fe6813db33010aac69ce9fa2ae6a0a8a969f10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE chapter PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
<chapter id="tdb">

<chapterinfo>
	&author.jht;
	
	<pubdate>May 28, 2008</pubdate>
</chapterinfo>

<title>Managing TDB Files</title>

<sect1>
<title>Features and Benefits</title>

	<para>
<indexterm><primary>tdb</primary></indexterm>
<indexterm><primary>Trivial Database</primary></indexterm>
	Samba uses a lightweight database called Trivial Database (tdb) in which it stores persistent and transient data.
	Some tdb files can be disposed of before restarting Samba, but others are used to store information that is vital
	to Samba configuration and behavior. The following information is provided to help administrators who are seeking
	to better manage their Samba installations.
	</para>

	<para>
<indexterm><primary>tdb</primary></indexterm>
<indexterm><primary>corrupted</primary></indexterm>
<indexterm><primary>backup</primary></indexterm>
<indexterm><primary>restore</primary></indexterm>
	Those who package Samba for commercial distribution with operating systems and appliances would do well to take
	note that tdb files can get corrupted, and for this reason ought to be backed up regularly.  An appropriate time
	is at system shutdown (backup) and startup (restore from backup).
	</para>

<para>
<indexterm><primary>NTDB</primary></indexterm>
</para>
	As of Samba 4.1, the NTDB format can be used if 'use ntdb' is set.  In this case, tdb files are automatically converted to ntdb files (with the .ntdb extension).  The old .tdb file is turned into a dangling symlink to 'This is now in an NTDB' to prevent it being accidentally used).  The table indicates what databases are currently available as NTDB files.

<table frame="all" id="TOSH-TDB">
                <title>Samba's Trivial Database Files</title>
                <tgroup align="center" cols="2">
                <thead>
                <row><entry>File name</entry><entry>Preserve</entry><entry>NTDB</entry><entry>Description</entry></row>
                </thead>

                <tbody>
                        <row><entry>account_policy.tdb</entry><entry>Y</entry><entry>N</entry>
				<entry><para>NT account policy settings such as pw expiration, etc...</para></entry></row>
                        <row><entry>brlock.tdb</entry><entry>N</entry><entry>N</entry>
				<entry><para>Byte range locks.</para></entry></row>
                        <row><entry>browse.dat</entry><entry>N</entry><entry>N</entry>
				<entry><para>Browse lists - gets rebuilt automatically.</para></entry></row>
                        <row><entry>connections.tdb</entry><entry>N</entry><entry>N</entry>
				<entry><para>Share connections. Used to enforce max connections, etc.</para></entry></row>
                        <row><entry>gencache.tdb</entry><entry>N</entry><entry>N</entry>
				<entry><para>Generic caching database.</para></entry></row>
                        <row><entry>group_mapping.tdb</entry><entry>Y</entry><entry>N</entry>
				<entry><para>Stores group mapping information. Not used when using LDAP backend.</para></entry></row>
                        <row><entry>  lang_en.tdb</entry><entry>Y</entry><entry>N</entry>
				<entry><para>Stores language encoding information.</para></entry></row>
                        <row><entry>locking.tdb</entry><entry>N</entry><entry>N</entry>
				<entry><para>Stores share mode and oplock information.</para></entry></row>
                        <row><entry>login_cache.tdb</entry><entry>N</entry><entry>N</entry>
				<entry><para>Keeps a log of bad pw attempts.</para></entry></row>
                        <row><entry>messages.tdb</entry><entry>N</entry><entry>N</entry>
				<entry><para>Used to keep track of Samba internal messaging.</para></entry></row>
                        <row><entry>netsamlogon_cache.tdb</entry><entry>Y</entry><entry>N</entry>
				<entry><para>
					Cache of user net_info_3 struct from <emphasis>net_samlogon()</emphasis>
					requests from domain member machines.
				</para></entry></row>
                        <row><entry>ntdrivers.tdb</entry><entry>Y</entry><entry>N</entry>
				<entry><para>Stores installed printer driver information.</para></entry></row>
                        <row><entry>ntforms.tdb</entry><entry>Y</entry><entry>N</entry>
				<entry><para>Stores installed printer forms information.</para></entry></row>
                        <row><entry>ntprinters.tdb</entry><entry>Y</entry><entry>N</entry>
				<entry><para>Stores installed printers information.</para></entry></row>
                        <row><entry>printing directory</entry><entry>Y</entry><entry>N</entry>
				<entry><para>Directory containing tdb per print queue of cached lpq output.</para></entry></row>
                        <row><entry>registry.tdb</entry><entry>Y</entry><entry>N</entry>
				<entry><para>Windows registry skeleton (connect via regedit.exe).</para></entry></row>
                        <row><entry>sessionid.tdb</entry><entry>N</entry><entry>N</entry>
				<entry><para>Session information to support <literal>utmp = yes</literal> capabilities.</para></entry></row>
                        <row><entry>share_info.tdb</entry><entry>Y</entry><entry>N</entry>
				<entry><para>Stores share-level ACL configuration settings.
					Default ACL is <emphasis>Everyone - Full Control</emphasis>.
				</para></entry></row>
                        <row><entry>unexpected.tdb</entry><entry>N</entry><entry>N</entry>
				<entry><para>
					Unexpected packet queue needed to support windows clients that respond on a 
					different port that the originating reques.
				</para></entry></row>
                        <row><entry>winbindd_cache.tdb</entry><entry>N</entry><entry>N</entry>
				<entry><para>Winbind's cache of user lists.</para></entry></row>
                        <row><entry>winbindd_idmap.tdb</entry><entry>Y</entry><entry>N</entry>
				<entry><para>Winbind's local IDMAP database.</para></entry></row>
                        <row><entry>wins.dat</entry><entry>N</entry><entry>N</entry>
				<entry><para>
				WINS database iused only when <parameter>wins support = yes</parameter>
				has been set. This gets rebuilt or updated at every restart.
				</para></entry></row>
                        <row><entry>wins.tdb</entry><entry>Y</entry><entry>N</entry>
				<entry><para>
				The working permanent storage for all WINS data. This database is used only
				when <parameter>wins support = yes</parameter> has been set in the &smb.conf; file.
				Note: This retains all manually configured WINS entries. Manual setting can be done use the net utility.
				</para></entry></row>
                        <row><entry>secrets.tdb</entry><entry>Y</entry><entry>Y</entry>
				<entry><para>
				This tdb file stores internal settings such as the machine and the domain SID, secret passwords
				that are used with LDAP, the machine secret token, etc. This is an essential file that is stored
				in a secure area. Vendors locate this in various folders. Check <command>smbd -b</command> to
				find its location on your system.
				</para></entry></row>
                        <row><entry>schannel_store.tdb</entry><entry>Y</entry><entry>Y</entry>
				<entry><para>
				This stores secure channel access token information used with SMB signing.
				</para></entry></row>
                        <row><entry>passdb.tdb</entry><entry>Y</entry><entry>N</entry>
				<entry><para>
				This stores the Samba SAM account information when using a tdbsam password backend.
				</para></entry></row>
                </tbody>
        </tgroup>
        </table>

</sect1>

<sect1>
<title>Managing TDB Files</title>

	<para>
	The <command>tdbbackup</command> utility is a tool that may be used to backup samba tdb files.
	This tool may also be used to verify the integrity of the tdb files prior to Samba startup or
	during normal operation. If it finds file damage it will search for a prior backup the backup
	file from which the damaged tdb file will be restored. The <command>tdbbackup</command>
	utility can safely be run at any time. It was designed so that it can be used at any time to
	validate the integrity of tdb files, even during Samba operation.
	</para>

	<para>
	It is recommended to backup all tdb files as part of the Samba start-up scripts on a Samba
	server. The following command syntax can be used:
	</para>
<screen>
myserver# > cd /var/lib/samba
myserver@ > tdbbackup *.tdb
</screen>
	<para>
	The default extension is <filename>.bak</filename>. Any alternate extension can be specified
	by executing <literal>tdbbackup -s 'new_extension' *.tdb</literal> as part of your startup script.
	</para>

</sect1>

</chapter>