What is SMB?
SMB is what you use when you open a shared folder like \\server\Shared in File Explorer, save to a home NAS or print to an office printer. It lets a computer open, read, write and lock files on another machine as if they were on its own disk.
Windows, macOS and Linux (through Samba) all speak it. Modern SMB 3 signs every message and can encrypt whole shares, while the old SMB1 is switched off because it is unsafe. It is built for local networks, so port 445 should never be open to the internet.
Think of it like this. SMB is like a library with a front desk. You show your card (session setup), ask for a room (tree connect to a share), then borrow a book, read pages and hand it back (create, read, close). The desk keeps track of who has which book so two people do not scribble on the same page at once.
Step by step
Normal
5 stepsArjun opens a spreadsheet from the office shared folder: a Kerberos ticket, then negotiate, log in, connect to the share and read the file.
Normal
5 stepsArjun opens a spreadsheet from the office shared folder: a Kerberos ticket, then negotiate, log in, connect to the share and read the file.
- 1
Get a ticket
Kerberos from the domain controller
In an office domain the PC asks the domain controller for a Kerberos ticket for the file server. Arjun does not type anything, because he signed in to Windows this morning.
- 2
Negotiate
Pick the SMB version
The PC lists the SMB dialects it knows and the server chooses the highest shared one, here 3.1.1. They also agree on signing and encryption methods.
- 3
Session setup
Log in with the ticket
The PC sends the ticket inside SESSION_SETUP. The server checks it and creates a session. At home without a domain, the same step uses NTLM and a password.
- 4
Tree connect
Open the share
TREE_CONNECT names the share, \\files.example.com\Shared. The server checks Arjun may use it and returns a tree id.
- 5
Open, read, close
CREATE, READ, CLOSE
CREATE opens the file (it is also used for files that already exist). READ asks for bytes at an offset. CLOSE lets go of the file.
SMB 3 encryption
4 stepsThe HR share is set to encrypt data, so salary files cross the network as AES-GCM ciphertext.
SMB 3 encryption
4 stepsThe HR share is set to encrypt data, so salary files cross the network as AES-GCM ciphertext.
- 1
Negotiate ciphers
AES-256-GCM first
In SMB 3.1.1 the PC offers a list of ciphers and the server chooses one. Here both prefer AES-256-GCM.
- 2
Log in
Kerberos as before
The session setup works the same way. Session keys for signing and encryption come out of this login.
- 3
HR share demands encryption
Share flag ENCRYPT_DATA
The admin set this share to require encryption. The TREE_CONNECT reply says so, and from then on every message for it is wrapped in a transform header.
- 4
Read, unreadable to others
Encrypted SMB3
Someone capturing traffic on the switch sees the file name and data only as random bytes. Without encryption SMB data is signed but readable.
SMB1 refused
3 stepsAn old scanner tries to save a scan with SMB1, and the modern file server refuses to talk.
SMB1 refused
3 stepsAn old scanner tries to save a scan with SMB1, and the modern file server refuses to talk.
- 1
Scan to folder
The scanner speaks only SMB1
Arjun scans a contract to the shared folder. The scanner's firmware is from 2012 and only offers the old SMB1 dialect, NT LM 0.12.
- 2
Refused
The server drops the connection
SMB1 is off on current Windows by default. A server without SMB1 cannot answer this negotiate, so it closes the connection and the scanner shows a network error.
- 3
Why SMB1 is gone
Unsafe, and once used by a worm
SMB1 has no modern signing or encryption, and a flaw in it let the WannaCry ransomware spread across networks in 2017. The fix is a firmware update with SMB2 or 3, or a scan-to-email setting, not turning SMB1 back on.
Wrong password
3 stepsAt home there is no domain, so Windows logs in to the NAS with NTLM, and a typo gets STATUS_LOGON_FAILURE.
Wrong password
3 stepsAt home there is no domain, so Windows logs in to the NAS with NTLM, and a typo gets STATUS_LOGON_FAILURE.
- 1
Negotiate
Same as in the office
Daniel types \\192.168.1.50\Photos. The laptop and NAS agree on an SMB 3 dialect.
- 2
NTLM challenge
Three messages
Without a domain there is no Kerberos. NTLM has the server send a random challenge, and the laptop answers with a value worked out from the password. The password itself is not sent.
- 3
Logon failure
0xC000006D
The answer does not match, so the NAS replies STATUS_LOGON_FAILURE. Windows shows The user name or password is incorrect and asks again.
Myths and mix-ups
- SMB is not only for Windows; macOS, Linux, phones and most NAS boxes speak it.
- Turning SMB1 back on is not a safe fix for an old device; update the device or use another way to send files.
- SMB 3 is not always encrypted; signing is common, but encryption must be enabled per share or for the server.
- Opening port 445 to the internet is never a good way to share files; use a VPN instead.
Try it yourself
Run these on your own computer to see SMB at work.
See your SMB connections and versions (Windows)
Get-SmbConnectionRun in PowerShell while a share is open. The Dialect column shows 3.1.1 on modern systems.
Map a share to a drive letter (Windows)
net use Z: \\files.example.com\Shared /user:EXAMPLE\arjunReplace the server, share and user with your own. net use /delete Z: removes it.
List shares on a server (Linux, macOS with Samba)
smbclient -L //files.example.com -U arjunAsks for the password, then lists the shares.
Is SMB1 still on? (Windows, as admin)
Get-SmbServerConfiguration | Select EnableSMB1ProtocolFalse is what you want.
SMB at a glance
- Layer
- Application (7)
- Port
- 445 over TCP; 139 for old NetBIOS setups
- Transport
- TCP; newer Windows Server can also use QUIC on 443
- Versions
- SMB1 (retired), SMB 2.0.2, 2.1, 3.0, 3.0.2, 3.1.1
- Login
- Kerberos in a domain, NTLM otherwise
- Security
- Signing; AES-GCM or AES-CCM encryption in SMB 3
- Defined in
- Microsoft open specification [MS-SMB2]
Defined in[MS-SMB2][MS-SMB][MS-NLMP]RFC 4120
Header fields
What SMB puts in its messages, with example values from the stories above.
SMB2
- Protocol id
0xFE 'SMB'0xFE marks SMB2 and SMB3. Old SMB1 starts with 0xFF instead.- Command
NEGOTIATE (0x0000)- Status
STATUS_SUCCESS (0x00000000)- Flags
Response, SignedA signature over the whole message stops anyone in the middle from changing it.- Message id
0- Dialects
2.0.2, 2.1, 3.0, 3.0.2, 3.1.1The server will pick the highest one both sides know.- Encryption ciphers
AES-128-GCM, AES-128-CCM, AES-256-GCM, AES-256-CCM- Signing
AES-GMAC, AES-CMAC- Dialect
3.1.1 (0x0311)3.1.1 adds a check that the negotiation itself was not tampered with (pre-auth integrity).- Security blob
SPNEGO: Kerberos, NTLMThe login methods the server accepts.
SMB3 transform header
- Protocol id
0xFD 'SMB'0xFD means an encrypted SMB3 message follows.- Signature
16-byte AES-GCM tagProves the encrypted message was not changed.- Nonce
unique per message- Session id
0x0000a40000000041- Inside (hidden)
CREATE salaries-2026.xlsxOnly the PC and the server can see this. Shown here for learning.
Captured
- Seen by onlooker
0xFD 'SMB' and random-looking bytesWith a normal signed share the onlooker could read the spreadsheet.
Test yourself
Which TCP port does modern SMB use?
Questions people ask
What port does SMB use?
TCP port 445. Very old networks also used ports 137 to 139 for NetBIOS. Never open 445 to the internet; use a VPN to reach shares from outside.
What is the difference between SMB and CIFS?
CIFS was the name for Microsoft's SMB1 dialect in the 1990s. Today people still say CIFS, but modern systems use SMB 2 and 3, which are quite different.
How do I check which SMB version I am using?
On Windows run Get-SmbConnection in PowerShell while a share is open and read the Dialect column. On macOS run smbutil statshares -a.
Is SMB secure?
SMB 3 with signing is safe on a trusted network, and turning on encryption protects data from anyone capturing traffic. SMB1 is not safe and should stay off.
Why can my old printer or scanner not save to a shared folder?
It probably only speaks SMB1, which modern Windows and NAS boxes refuse. Look for a firmware update that adds SMB2 or 3, or use scan to email instead.
Is SFTP or SMB better for sharing files?
SMB is best inside an office or home, where it works like a normal drive. SFTP is better across the internet, because it runs over SSH and is easy to secure.