Information Gathering
Learn how to use SMBClient on Kali Linux: install Samba's FTP-like SMB/CIFS client, list shares, connect as a guest or with credentials, browse folders, and upload or download files on Windows, Samba, or NAS devices. For authorized assessments, check ports 139/445 with Nmap before testing share permissions.
sudo apt install smbclient
smbclient //<host>/<share> [options]
Here's how to use smbclient: install it if needed (Kali Linux usually includes it). For an authorized host, run smbclient -L //target -N to list shares, then connect with smbclient //target/share -U user and enter your password. At the smb: \> prompt, use ls to list files, cd to change directories, get to download, and put to upload.
On Kali Linux, run sudo apt install smbclient if needed, then check with smbclient --version. Before contacting the server, confirm that you own it or have explicit written authorization to test it, and assume connection attempts are logged. In the lab, run nmap -p 139,445 192.168.1.10 to check the SMB ports. If either port is open, list visible shares with smbclient -L //192.168.1.10 -N and connect with smbclient //192.168.1.10/data -U user. Use ls and cd to browse, then get readme.txt to download an approved file. If write testing is in scope, use put /tmp/test.txt test_write.txt with a harmless local test file and an unused destination name. Type exit and document which shares you accessed, what you transferred, and which permissions you verified.
Illustrative output from a lab configured to show these share names without a password: $ smbclient -L //192.168.1.10 -N Sharename Type Comment --------- ---- ------- ADMIN$ Disk Remote Admin C$ Disk Default share IPC$ IPC Remote IPC data Disk Project files ADMIN$ is a hidden share for remote administration. C$ is the hidden administrative share for the C: drive. Both normally require administrator credentials, even if their names appear in the listing. IPC$ is for named pipes, not files. The data entry is a Disk share labeled Project files, and this lab allows guest access to it. Connect and run ls. The listing excerpt shows two files: $ smbclient //192.168.1.10/data -N smb: \> ls readme.txt A 416 Thu Dec 3 10:12:00 2026 projects.csv R 2048 Thu Dec 3 10:15:00 2026 readme.txt is 416 bytes, has the Archive attribute (A), and shows a timestamp of 10:12 on December 3, 2026. projects.csv is 2048 bytes, has the Read-only attribute (R), and shows a timestamp of 10:15 that day. The R applies to that file, not the whole share.
To install smbclient on Kali Linux, first run smbclient --version: Kali normally includes it, but you can run sudo apt install smbclient if it is missing. On Debian or Ubuntu, run sudo apt update && sudo apt install smbclient. On RHEL, CentOS, or Fedora, run sudo dnf install samba-client (use yum on older systems). On macOS, run brew install samba. Windows has no native smbclient binary: run wsl --install and use the Debian or Ubuntu apt command inside WSL, or use net use for ordinary share access.
An "smb client" is any program that uses SMB/CIFS to open shared folders on another computer. Windows has one built in: enter \\server\share in File Explorer or use net use in Command Prompt. On Linux, Samba's smbclient is a command-line SMB client.
SMBClient is an interactive command-line utility included in the Samba suite that provides FTP-like access to SMB/CIFS (Server Message Block/Common Internet File System) resources on Windows, Samba, and other SMB-compatible servers. It enables users to browse shared folders, list directory contents, and transfer files to and from remote systems over the SMB protocol.
The tool operates by establishing SMB sessions to target hosts on ports 139 (NetBIOS Session Service) or 445 (Direct Host SMB), authenticating with optional credentials, and providing an interactive shell where users can execute file operations. SMBClient supports anonymous (null session) access for testing misconfigured shares, authenticated access with username/password combinations, and domain authentication for enterprise Active Directory environments.
For penetration testers and security auditors, SMBClient is essential for verifying share access permissions, testing anonymous login configurations, downloading files for analysis, and assessing SMB security posture. Unlike automated enumeration tools, SMBClient provides hands-on interactive access that allows deep inspection of share contents, permission testing, and file-level operations critical for comprehensive security assessments.
| Command | Purpose |
|---|---|
smbclient -L <lab-host> -N | List anonymously visible shares without prompting for a password. |
smbclient //<lab-host>/<share> -U '<lab-domain>/<lab-user>' | Open an authenticated interactive session and prompt for the password. |
smbclient //<lab-host>/<share> -N -c 'ls' | Anonymously list the share root. |
smbclient //<lab-host>/<share> -U '<lab-domain>/<lab-user>' -c 'allinfo <remote-file>' | Display metadata for a remote file. |
smbclient //<lab-host>/<share> -U '<lab-domain>/<lab-user>' -c 'get <remote-file> <local-copy>' | Download one approved file for analysis. |
smbclient //<lab-host>/<share> -U '<lab-domain>/<lab-user>' -c 'du' | Report share or directory disk usage. |
smbclient -L //192.168.1.1 -NList shares anonymously — see all available shares on the target without entering any credentialssmbclient //192.168.1.1/share -U username%passwordConnect to a share with username and password — access a specific shared folder using credentialssmbclient //192.168.1.1/share -NAnonymous connection — connect to a shared folder without a password to test for misconfigured sharesget filenameDownload file (interactive) — retrieve a single file from the share after connectingput filenameUpload file (interactive) — transfer a local file to the share after connectingsmbclient -L //192.168.1.1 -U domain\user%passwordDomain authenticated listing — list shares using Active Directory domain credentialssmbclient //192.168.1.1/share -c 'ls'Non-interactive directory listing — list share contents from the command line without entering the shellsmbclient //192.168.1.1/share -U user -c 'get remote.txt local.txt'Direct file download — download a specific file without entering the interactive shellsmbclient //192.168.1.1/share -U user -c 'put local.txt remote.txt'Direct file upload — upload a specific file without entering the interactive shellsmbclient //192.168.1.1/share -N -c 'recurse; ls'Recursive directory listing — list all files and subdirectories recursively using the -c flagsmbclient //192.168.1.1/share -N -c 'tarmode archive compress; tar c files.tar *'Recursive tar download — archive the entire share contents into a local tar file for bulk extractionsmbclient -L //192.168.1.1 -N -d 3Debug connection — list shares with debug level 3 to see detailed protocol and connection informationsmbclient //192.168.1.1/share -U user -m SMB2Force SMB2 protocol — explicitly connect using the SMB2 protocol instead of auto-negotiatingsmbclient //192.168.1.1/share -U user -W WORKGROUPSet workgroup — connect to a share using a specific Windows workgroup or domain namesmbclient //192.168.1.1/share -N -c 'mask *.log; mget *'Bulk download with mask — download all files matching a specific pattern from the sharesmbclient //192.168.1.1/share -U user -c 'mkdir new_folder'Create directory — create a new folder on the share (requires write permissions)smbclient //192.168.1.1/share -U user -c 'del old_file.txt'Delete file — remove a file from the share (requires write and delete permissions)smbclient //192.168.1.1/share -U administrator --pw-nt-hash <ntlm_hash>Pass-the-Hash — authenticate with an NTLM hash instead of a plaintext password (--pw-nt-hash tells smbclient the supplied value is the hash; --password would treat it as plaintext)smbclient -L //192.168.1.1 -g -NList visible shares without a password prompt. The -g flag makes -L output easier to parse with grep or cut.smbclient //192.168.1.1/share -U user -A auth.txtConnect using a credentials file with username, password and domain lines. Restrict file access with chmod 600 auth.txt before adding the password.smbclient //192.168.1.1/share -U user -m SMB3Set SMB3 as the maximum protocol, not a requirement to negotiate SMB3. SMB2 and NT1 are lower maximums for legacy servers; the client's configured minimum still applies.smbclient --versionShow the installed smbclient version to verify an installation or check whether Kali Linux already includes it.Verify whether SMB shares are accessible anonymously or with provided credentials, testing for misconfigurations that expose sensitive data to unauthorized users.
Download files from accessible shares during penetration tests to demonstrate data exposure risks and assess the sensitivity of information stored on network shares.
After Enum4Linux or NBTScan discovers shares, use SMBClient to manually verify access permissions, test write capabilities, and confirm share-level security controls.
Access compromised file shares during incident response to recover deleted files, examine staged attacker data, or verify backup integrity on network storage.
Interactive exploration of discovered SMB shares to understand their contents, identify sensitive documents, and map the data landscape of Windows networks.
Use non-interactive mode (-c flag) to script file downloads, uploads, and directory listings for automated security testing pipelines and batch operations.
SMBClient is interactive with an FTP-like shell for manual exploration; SMBMap is non-interactive and optimized for automated enumeration and bulk downloads. Use SMBClient for hands-on testing, SMBMap for scripting.
Yes, SMBClient supports SMB2 and SMB3 including encryption. Use '-m SMB3' to force SMB3 protocol negotiation. Encryption protects credentials and data in transit on untrusted networks.
Use '--pw-nt-hash <ntlm_hash>' instead of a plaintext password: 'smbclient //10.10.10.10/share -U administrator --pw-nt-hash aad3b435b51404ee...'. This authenticates using the NTLM hash directly, useful when you have extracted hashes but not cracked them.
NT_STATUS_ACCESS_DENIED (wrong perms), NT_STATUS_LOGON_FAILURE (bad creds), NT_STATUS_BAD_NETWORK_NAME (wrong share), connection refused (port blocked/firewall). Debug with '-d 3' to see the full SMB exchange.
Yes. SMBClient is part of the Samba suite and comes pre-installed on Kali Linux. Verify with 'smbclient --version'. On other distributions, install via 'sudo apt install smbclient' or 'sudo dnf install samba-client'.
Information Gathering
Learn how to use Enum4linux to enumerate Windows and Samba systems over SMB: install it on Kali Linux, run your first scan, read the users, shares, groups and password policy it returns, and switch to enum4linux-ng for modern hosts that block null sessions.
Information Gathering
Learn how to use Nmap, the free open-source network scanner: run your first port scan, discover live hosts, detect services and operating systems, and check for vulnerabilities with NSE scripts — a beginner tutorial for Kali Linux.
Information Gathering
enum4linux-ng is a next-generation version of the classic enum4linux script, rewritten from scratch in Python 3 to parse and enumerate Windows/Samba information efficiently with cleaner output formats.
Information Gathering
NBTScan is a program for scanning IP networks for NetBIOS name information. It sends a NetBIOS status query to each address in the supplied range and lists received information in human-readable form.
Post Exploitation
NetExec (formerly CrackMapExec successor) is a post-exploitation tool for enumerating and attacking Active Directory environments. It automates SMB, WinRM, LDAP, and SSH attacks across large networks with support for Kerberos, NTLM, and pass-the-hash authentication.
Post Exploitation
CrackMapExec (CME) is a post-exploitation tool for pentesting Windows and Active Directory networks. It can enumerate users, spray passwords, execute commands, and move laterally.
Complete guide to SMB enumeration for discovering Windows shares, users, groups, and network resources using Enum4Linux, SMBClient, NBTScan, and Nmap.
Guides · AdvancedA complete beginner-to-advanced SMB enumeration guide covering discovery, NetBIOS, share access, user enumeration, automation, troubleshooting, workflow design, and SMB tool selection.
Tools · BeginnerLearn Enum4Linux for enumerating Windows and Samba systems including user lists, shares, groups, and security policy information.
Guides · IntermediateGuide to assessing SMB security including anonymous access testing, share permission analysis, credential attacks, and hardening recommendations for Windows file shares.
The list command (-L) outputs a table with three columns: Sharename (the UNC name you connect to), Type (Disk for file shares, IPC for named pipes, Print for printers), and Comment (an optional description set by the administrator). An anonymous listing may show fewer shares than an authenticated one because Windows restricts null session visibility by default. Once connected, the smb: \> prompt indicates an active session. Directory listings (ls) show filenames, sizes in bytes, timestamps, and DOS attributes (A = Archive, D = Directory, R = Read-only, H = Hidden, S = System). Error messages include NT_STATUS_ACCESS_DENIED (share exists but you lack permission), NT_STATUS_LOGON_FAILURE (bad username or password), NT_STATUS_BAD_NETWORK_NAME (share name does not exist), and connection refused (SMB service is down or blocked). Use the -d flag (e.g., -d 3) for verbose debug output that reveals protocol negotiation details, authentication exchanges, and connection state.
This tool is designed for authorized security testing, educational purposes, and legitimate network administration only. Unauthorized access to computer systems is illegal.