summaryrefslogtreecommitdiff
path: root/docs/htmldocs/IntroSMB.html
blob: 51a22f14fad95764eedfe405a4961a546dcbfe2d (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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 1. Introduction to Samba</title><link rel="stylesheet" href="samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.60.1"><link rel="home" href="samba-doc.html" title="SAMBA Project Documentation"><link rel="up" href="introduction.html" title="Part I. General Installation"><link rel="previous" href="introduction.html" title="Part I. General Installation"><link rel="next" href="install.html" title="Chapter 2. How to Install and Test SAMBA"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 1. Introduction to Samba</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="introduction.html">Prev</a> </td><th width="60%" align="center">Part I. General Installation</th><td width="20%" align="right"> <a accesskey="n" href="install.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="IntroSMB"></a>Chapter 1. Introduction to Samba</h2></div><div><div class="author"><h3 class="author"><span class="firstname">David</span> <span class="surname">Lechnyr</span></h3><div class="affiliation"><span class="orgname">Unofficial HOWTO<br></span><div class="address"><p><tt class="email">&lt;<a href="mailto:david@lechnyr.com">david@lechnyr.com</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate">April 14, 2003</p></div></div><div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="IntroSMB.html#id2817919">Background</a></dt><dt><a href="IntroSMB.html#id2817978">Terminology</a></dt><dt><a href="IntroSMB.html#id2818169">Related Projects</a></dt><dt><a href="IntroSMB.html#id2818237">SMB Methodology</a></dt><dt><a href="IntroSMB.html#id2818345">Epilogue</a></dt><dt><a href="IntroSMB.html#id2818430">Miscellaneous</a></dt></dl></div><p>&#8220;<span class="quote">
&quot;If you understand what you're doing, you're not learning anything.&quot; 
-- Anonymous
</span>&#8221;</p><p>
Samba is a file and print server for Windows-based clients using TCP/IP as the underlying
transport protocol. In fact, it can support any SMB/CIFS-enabled client. One of Samba's big
strengths is that you can use it to blend your mix of Windows and Linux machines together
without requiring a separate Windows NT/2000/2003 Server.  Samba is actively being developed
by a global team of about 30 active programmers and was originally developed by Andrew Tridgell.
</p><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2817919"></a>Background</h2></div></div><div></div></div><p>
Once long ago, there was a buzzword referred to as DCE/RPC. This stood for Distributed
Computing Environment/Remote Procedure Calls and conceptually was a good idea. It was
originally developed by Apollo/HP as NCA 1.0 (Network Computing Architecture) and only
ran over UDP. When there was a need to run it over TCP so that it would be compatible
with DECnet 3.0, it was redesigned, submitted to The Open Group, and officially became
known as DCE/RPC. Microsoft came along and decided, rather than pay $20 per seat to
license this technology, to reimplement DCE/RPC themselves as MSRPC. From this, the
concept continued in the form of SMB (Server Message Block, or the &quot;what&quot;) using the
NetBIOS (Network Basic Input/Output System, or the &quot;how&quot;) compatibility layer. You can
run SMB (i.e., transport) over several different protocols; many different implementations
arose as a result, including NBIPX (NetBIOS over IPX, NwLnkNb, or NWNBLink) and NBT
(NetBIOS over TCP/IP, or NetBT). As the years passed, NBT became the most common form
of implementation until the advance of &quot;Direct-Hosted TCP&quot; -- the Microsoft marketing
term for eliminating NetBIOS entirely and running SMB by itself across TCP port 445
only. As of yet, direct-hosted TCP has yet to catch on.
</p><p>
Perhaps the best summary of the origins of SMB are voiced in the 1997 article titled, CIFS:
Common Insecurities Fail Scrutiny:
</p><p><span class="emphasis"><em>
Several megabytes of NT-security archives, random whitepapers, RFCs, the CIFS spec, the Samba
stuff, a few MS knowledge-base articles, strings extracted from binaries, and packet dumps have
been dutifully waded through during the information-gathering stages of this project, and there
are *still* many missing pieces... While often tedious, at least the way has been generously
littered with occurrences of clapping hand to forehead and muttering 'crikey, what are they
thinking?
</em></span></p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2817978"></a>Terminology</h2></div></div><div></div></div><div class="itemizedlist"><ul type="disc"><li><p>
	SMB: Acronym for &quot;Server Message Block&quot;. This is Microsoft's file and printer sharing protocol.
	</p></li><li><p>
	CIFS: Acronym for &quot;Common Internet File System&quot;. Around 1996, Microsoft apparently
	decided that SMB needed the word &quot;Internet&quot; in it, so they changed it to CIFS.  
	</p></li><li><p>
	Direct-Hosted: A method of providing file/printer sharing services over port 445/tcp
	only using DNS for name resolution instead of WINS.
	</p></li><li><p>
	IPC: Acronym for &quot;Inter-Process Communication&quot;. A method to communicate specific
	information between programs.
	</p></li><li><p>
	Marshalling: - A method of serializing (i.e., sequential ordering of) variable data
	suitable for transmission via a network connection or storing in a file. The source
	data can be re-created using a similar process called unmarshalling.
	</p></li><li><p>
	NetBIOS: Acronym for &quot;Network Basic Input/Output System&quot;. This is not a protocol;
	it is a method of communication across an existing protocol. This is a standard which
	was originally developed for IBM by Sytek in 1983. To exaggerate the analogy a bit,
	it can help to think of this in comparison your computer's BIOS -- it controls the
	essential functions of your input/output hardware -- whereas NetBIOS controls the
	essential functions of your input/output traffic via the network. Again, this is a bit
	of an exaggeration but it should help that paradigm shift. What is important to realize
	is that NetBIOS is a transport standard, not a protocol. Unfortunately, even technically
	brilliant people tend to interchange NetBIOS with terms like NetBEUI without a second
	thought; this will cause no end (and no doubt) of confusion.
	</p></li><li><p>
	NetBEUI: Acronym for the &quot;NetBIOS Extended User Interface&quot;. Unlike NetBIOS, NetBEUI
	is a protocol, not a standard. It is also not routable, so traffic on one side of a
	router will be unable to communicate with the other side. Understanding NetBEUI is
	not essential to deciphering SMB; however it helps to point out that it is not the
	same as NetBIOS and to improve your score in trivia at parties. NetBEUI was originally
	referred to by Microsoft as &quot;NBF&quot;, or &quot;The Windows NT NetBEUI Frame protocol driver&quot;.
	It is not often heard from these days.
	</p></li><li><p>
	NBT: Acronym for &quot;NetBIOS over TCP&quot;; also known as &quot;NetBT&quot;. Allows the continued use
	of NetBIOS traffic proxied over TCP/IP. As a result, NetBIOS names are made 
	to IP addresses and NetBIOS name types are conceptually equivalent to TCP/IP ports.
	This is how file and printer sharing are accomplished in Windows 95/98/ME. They 
	traditionally rely on three ports: NetBIOS Name Service (nbname) via UDP port 137, 
	NetBIOS Datagram Service (nbdatagram) via UDP port 138, and NetBIOS Session Service 
	(nbsession) via TCP port 139. All name resolution is done via WINS, NetBIOS broadcasts, 
	and DNS. NetBIOS over TCP is documented in RFC 1001 (Concepts and methods) and RFC 1002 
	(Detailed specifications).
	</p></li><li><p>
	W2K: Acronym for Windows 2000 Professional or Server
	</p></li><li><p>
	W3K: Acronym for Windows 2003 Server
	</p></li></ul></div><p>If you plan on getting help, make sure to subscribe to the Samba Mailing List (available at 
<a href="http://www.samba.org/" target="_top">http://www.samba.org</a>). 
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2818169"></a>Related Projects</h2></div></div><div></div></div><p>
There are currently two network filesystem client projects for Linux that are directly
related to Samba: SMBFS and CIFS VFS.  These are both available in the Linux kernel itself.
</p><div class="itemizedlist"><ul type="disc"><li><p>
	SMBFS (Server Message Block File System) allows you to mount SMB shares (the protocol
	that Microsoft Windows and OS/2 Lan Manager use to share files and printers 
	over local networks) and access them just like any other Unix directory. This is useful 
	if you just want to mount such filesystems without being a SMBFS server.
	</p></li><li><p>
	CIFS VFS (Common Internet File System Virtual File System) is the successor to SMBFS, and
        is being actively developed for the upcoming version of the Linux kernel. The intent of this module
        is to provide advanced network file system functionality including support for dfs (hierarchical
	name space), secure per-user session establishment, safe distributed caching (oplock), 
	optional packet signing, Unicode and other internationalization improvements, and optional 
	Winbind (nsswitch) integration.
        </p></li></ul></div><p>
Again, it's important to note that these are implementations for client filesystems, and have
nothing to do with acting as a file and print server for SMB/CIFS clients.
</p><p>
There are other Open Source CIFS client implementations, such as the 
<a href="http://jcifs.samba.org/" target="_top">jCIFS project</a>
which provides an SMB client toolkit written in Java.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2818237"></a>SMB Methodology</h2></div></div><div></div></div><p>
Traditionally, SMB uses UDP port 137 (NetBIOS name service, or netbios-ns),
UDP port 138 (NetBIOS datagram service, or netbios-dgm), and TCP port 139 (NetBIOS
session service, or netbios-ssn). Anyone looking at their network with a good
packet sniffer will be amazed at the amount of traffic generated by just opening
up a single file. In general, SMB sessions are established in the following order:
</p><div class="itemizedlist"><ul type="disc"><li><p>
	&quot;TCP Connection&quot; - establish 3-way handshake (connection) to port 139/tcp
    or 445/tcp.
	</p></li><li><p>
	&quot;NetBIOS Session Request&quot; - using the following &quot;Calling Names&quot;: The local
    machine's NetBIOS name plus the 16th character 0x00; The server's NetBIOS
    name plus the 16th character 0x20
	</p></li><li><p>
	&quot;SMB Negotiate Protocol&quot; - determine the protocol dialect to use, which will
    be one of the following: PC Network Program 1.0 (Core) - share level security
    mode only; Microsoft Networks 1.03 (Core Plus) - share level security
    mode only; Lanman1.0 (LAN Manager 1.0) - uses Challenge/Response
    Authentication; Lanman2.1 (LAN Manager 2.1) - uses Challenge/Response
    Authentication; NT LM 0.12 (NT LM 0.12) - uses Challenge/Response
    Authentication
	</p></li><li><p>
	SMB Session Startup. Passwords are encrypted (or not) according to one of
    the following methods: Null (no encryption); Cleartext (no encryption); LM
    and NTLM; NTLM; NTLMv2
	</p></li><li><p>
	SMB Tree Connect: Connect to a share name (e.g., \\servername\share); Connect
    to a service type (e.g., IPC$ named pipe)
	</p></li></ul></div><p>
A good way to examine this process in depth is to try out 
<a href="http://www.securityfriday.com/ToolDownload/SWB/swb_doc.html" target="_top">SecurityFriday's SWB program</a>.
It allows you to walk through the establishment of a SMB/CIFS session step by step.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2818345"></a>Epilogue</h2></div></div><div></div></div><p>&#8220;<span class="quote">
What's fundamentally wrong is that nobody ever had any taste when they
did it. Microsoft has been very much into making the user interface look good,
but internally it's just a complete mess. And even people who program for Microsoft
and who have had years of experience, just don't know how it works internally.
Worse, nobody dares change it. Nobody dares to fix bugs because it's such a
mess that fixing one bug might just break a hundred programs that depend on
that bug. And Microsoft isn't interested in anyone fixing bugs -- they're interested
in making money. They don't have anybody who takes pride in Windows 95 as an
operating system.
</span>&#8221;</p><p>&#8220;<span class="quote">
People inside Microsoft know it's a bad operating system and they still
continue obviously working on it because they want to get the next version out
because they want to have all these new features to sell more copies of the
system.
</span>&#8221;</p><p>&#8220;<span class="quote">
The problem with that is that over time, when you have this kind of approach,
and because nobody understands it, because nobody REALLY fixes bugs (other than
when they're really obvious), the end result is really messy. You can't trust
it because under certain circumstances it just spontaneously reboots or just
halts in the middle of something that shouldn't be strange. Normally it works
fine and then once in a blue moon for some completely unknown reason, it's dead,
and nobody knows why. Not Microsoft, not the experienced user and certainly
not the completely clueless user who probably sits there shivering thinking
&quot;What did I do wrong?&quot; when they didn't do anything wrong at all.
</span>&#8221;</p><p>&#8220;<span class="quote">
That's what's really irritating to me.&quot;
</span>&#8221;</p><p>-- 
<a href="http://hr.uoregon.edu/davidrl/boot.txt" target="_top">Linus Torvalds, from an interview with BOOT Magazine, Sept 1998</a>
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2818430"></a>Miscellaneous</h2></div></div><div></div></div><p>
This chapter is Copyright 2003 David Lechnyr (david at lechnyr dot com).
Permission is granted to copy, distribute and/or modify this document under the terms
of the GNU Free Documentation License, Version 1.2 or any later version published by the Free
Software Foundation. A copy of the license is available at http://www.gnu.org/licenses/fdl.txt.
</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="introduction.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="introduction.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="install.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Part I. General Installation </td><td width="20%" align="center"><a accesskey="h" href="samba-doc.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 2. How to Install and Test SAMBA</td></tr></table></div></body></html>