GO KALI FREE

SMBClient

Information Gathering

Beginnermedium risk

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.

Installation

sudo apt install smbclient

Basic Syntax

smbclient //<host>/<share> [options]

Quick Facts

Category
SMB Client / File Transfer
Platform
Linux (Samba suite)
Protocol
SMB/CIFS (ports 139/445)
Difficulty
Beginner-Friendly
Common Usage
Share Access & File Transfer
Default Port
445 (SMB), 139 (NetBIOS)
License
GPL v3 (Samba)
Dependencies
Samba client libraries

Tool Overview

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.

Quick Reference Commands

Verified quick-reference commands for SMBClient
CommandPurpose
smbclient -L <lab-host> -NList 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 manual

Common Commands

smbclient -L //192.168.1.1 -NList shares anonymously — see all available shares on the target without entering any credentials
smbclient //192.168.1.1/share -U username%passwordConnect to a share with username and password — access a specific shared folder using credentials
smbclient //192.168.1.1/share -NAnonymous connection — connect to a shared folder without a password to test for misconfigured shares
get filenameDownload file (interactive) — retrieve a single file from the share after connecting
put filenameUpload file (interactive) — transfer a local file to the share after connecting
smbclient -L //192.168.1.1 -U domain\user%passwordDomain authenticated listing — list shares using Active Directory domain credentials
smbclient //192.168.1.1/share -c 'ls'Non-interactive directory listing — list share contents from the command line without entering the shell
smbclient //192.168.1.1/share -U user -c 'get remote.txt local.txt'Direct file download — download a specific file without entering the interactive shell
smbclient //192.168.1.1/share -U user -c 'put local.txt remote.txt'Direct file upload — upload a specific file without entering the interactive shell
smbclient //192.168.1.1/share -N -c 'recurse; ls'Recursive directory listing — list all files and subdirectories recursively using the -c flag
smbclient //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 extraction
smbclient -L //192.168.1.1 -N -d 3Debug connection — list shares with debug level 3 to see detailed protocol and connection information
smbclient //192.168.1.1/share -U user -m SMB2Force SMB2 protocol — explicitly connect using the SMB2 protocol instead of auto-negotiating
smbclient //192.168.1.1/share -U user -W WORKGROUPSet workgroup — connect to a share using a specific Windows workgroup or domain name
smbclient //192.168.1.1/share -N -c 'mask *.log; mget *'Bulk download with mask — download all files matching a specific pattern from the share
smbclient //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.

Step-by-Step Guide

  1. 1Kali Linux normally includes smbclient; check with smbclient --version and 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; on macOS, run brew install samba. After installation, verify with smbclient --version.
  2. 2Before contacting the host, confirm that you own it or have explicit written authorization to test it, and assume connection attempts are logged. For the lab host, run nmap -p 139,445 192.168.1.10 and proceed only if at least one of those TCP ports is open.
  3. 3If anonymous testing is in scope, run smbclient -L //192.168.1.10 -N to list shares without a password prompt. The list shows only the shares visible to that session; it does not tell you which shares you can open.
  4. 4Read the Sharename, Type, and Comment columns; the comment may explain what a share is for. Disk entries are file shares, IPC$ is for named pipes, and Print entries are for printers. ADMIN$ and C$ are hidden administrative Disk shares that normally require administrator credentials.
  5. 5Connect with smbclient //192.168.1.10/data -U user and enter the approved account's password when prompted. The -U option also accepts user%password, but using the prompt keeps the password off the command line. If the share is configured for guest access, use smbclient //192.168.1.10/data -N instead.
  6. 6At the smb: \> prompt, use ls to list files and cd foldername to move into a listed directory. Type help to see the available commands.
  7. 7Use get readme.txt to download a file or put local.txt remote.txt to upload a local file if writing is allowed. Run recurse on to enable recursive mode, then set a filter such as mask *.txt before running mget * to download only matching files.
  8. 8For a bulk copy you are authorized to make, start at the share root, use recurse to turn recursion on if it is off, then run mask * and mget *. For a large share, run tarmode archive; tar c backup.tar * from the share root instead to create an uncompressed local tar archive.
  9. 9If write testing is approved, create a harmless local file at /tmp/test.txt, then run put /tmp/test.txt test_write.txt in an approved test folder where that name is not in use. NT_STATUS_ACCESS_DENIED means the upload was denied for that account and destination; it does not prove the whole share is read-only.
  10. 10Type exit or quit to close the session. Record the shares you accessed, the files you transferred, and the permissions you verified. If your written scope includes automated inventory, use smbmap or enum4linux for that inventory.

Warnings

Use Cases

Share Access Testing

Verify whether SMB shares are accessible anonymously or with provided credentials, testing for misconfigurations that expose sensitive data to unauthorized users.

File Exfiltration Testing

Download files from accessible shares during penetration tests to demonstrate data exposure risks and assess the sensitivity of information stored on network shares.

Security Audit Verification

After Enum4Linux or NBTScan discovers shares, use SMBClient to manually verify access permissions, test write capabilities, and confirm share-level security controls.

Incident Response File Recovery

Access compromised file shares during incident response to recover deleted files, examine staged attacker data, or verify backup integrity on network storage.

Network Share Enumeration

Interactive exploration of discovered SMB shares to understand their contents, identify sensitive documents, and map the data landscape of Windows networks.

Automated File Operations

Use non-interactive mode (-c flag) to script file downloads, uploads, and directory listings for automated security testing pipelines and batch operations.

Key Features

People Also Ask

What is the difference between SMBClient and SMBMap?

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.

Does SMBClient support SMB3 encryption?

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.

How do I use Pass-the-Hash with SMBClient?

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.

What are common SMBClient error codes?

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.

Is SMBClient installed on Kali Linux by default?

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'.

Learning Path

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5

Related Tools

Enum4linux

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.

Nmap

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.

enum4linux-ng

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.

NBTScan

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.

NetExec

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.

CrackMapExec

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.

Related Cybersecurity Guides

Tools · Beginner

SMB Enumeration Guide: Discovering Windows Shares and Users

Complete guide to SMB enumeration for discovering Windows shares, users, groups, and network resources using Enum4Linux, SMBClient, NBTScan, and Nmap.

Guides · Advanced

SMB Enumeration Complete Guide: Beginner to Advanced Windows Reconnaissance

A complete beginner-to-advanced SMB enumeration guide covering discovery, NetBIOS, share access, user enumeration, automation, troubleshooting, workflow design, and SMB tool selection.

Tools · Beginner

Enum4Linux Guide: Windows/Samba Enumeration

Learn Enum4Linux for enumerating Windows and Samba systems including user lists, shares, groups, and security policy information.

Guides · Intermediate

SMB Security Assessment: Testing Share Permissions and Access Controls

Guide to assessing SMB security including anonymous access testing, share permission analysis, credential attacks, and hardening recommendations for Windows file shares.

Frequently Asked Questions

What is SMBClient?

SMBClient is a command-line utility from the Samba suite that provides FTP-like access to SMB/CIFS file shares on Windows, Samba, and NAS devices. It allows you to browse directories, download files, upload files, and perform file operations on remote SMB shares using the SMB protocol on ports 139 or 445.

How does SMBClient work?

SMBClient establishes an SMB session to the target host on port 445 (or 139 for NetBIOS), authenticates using optional credentials, and provides an interactive shell where you can execute file operations like ls (list), get (download), put (upload), and tar (archive). It supports anonymous, password, domain, and Kerberos authentication.

How do I use SMBClient?

Basic usage: smbclient -L //<ip> -N to list shares anonymously. smbclient //<ip>/<share> -U user%pass to connect with credentials. Once connected, use ls to list files, get to download, put to upload, and exit to quit. Use -c for non-interactive commands: smbclient //host/share -U user -c 'ls'.

How do I connect to a Windows share?

Connect using: smbclient //<windows_ip>/<share_name> -U <username>%<password>. For domain authentication: smbclient //<ip>/<share> -U CORP\admin%pass. For anonymous access: smbclient //<ip>/<share> -N. First list available shares with smbclient -L //<ip> -N to find share names.

How do I list SMB shares?

List shares anonymously: smbclient -L //<target_ip> -N. List with credentials: smbclient -L //<ip> -U user%pass. The output shows share names, types (Disk, IPC, Print), and comments. Use -d 3 for debug output if the listing fails.

How do I download files from SMBClient?

Download a file: connect to the share, then use 'get filename.txt'. For bulk downloads: 'recurse on; mget *'. For pattern downloads: 'mask *.log; mget *'. Non-interactive download: smbclient //host/share -U user -c 'get remote.txt local.txt'. For archive downloads: 'tarmode archive; tar c backup.tar *'.

How do I upload files with SMBClient?

Upload a file: connect to the share, then use 'put local_file.txt'. For bulk uploads: 'recurse on; mput *.txt'. Non-interactive upload: smbclient //host/share -U user -c 'put local.txt remote.txt'. Ensure you have write permissions on the share — NT_STATUS_ACCESS_DENIED means the share is read-only.

How do I install SMBClient on Ubuntu?

Install SMBClient on Ubuntu/Debian: sudo apt install smbclient. It is pre-installed on Kali Linux. On other distributions: sudo yum install samba-client (RHEL/CentOS), sudo pacman -S samba (Arch), or sudo zypper install samba-client (openSUSE). Verify installation: smbclient --version.

How do I install SMBClient on Kali Linux?

SMBClient is pre-installed on Kali Linux as part of the Samba suite. If missing: sudo apt update && sudo apt install smbclient. Verify with smbclient --version. Kali includes all necessary Samba client libraries for SMB1, SMB2, and SMB3 support.

What port does SMBClient use?

SMBClient uses port 445 (Direct Host SMB) by default for modern Windows systems, and port 139 (NetBIOS Session Service) for older systems and Samba. It also uses port 137 (NetBIOS Name Service) for name resolution. Verify ports with Nmap: nmap -p 137,138,139,445 <target>.

Can SMBClient access SMBv1?

Yes, SMBClient supports SMB1, SMB2, and SMB3 protocols. Use -m SMB1 to force SMB1, -m SMB2 for SMB2, or -m SMB3 for SMB3. SMBClient auto-negotiates the highest mutually supported protocol by default. Note that SMB1 is deprecated and disabled on modern Windows systems due to security vulnerabilities.

What is the difference between SMBClient and SMBMap?

SMBClient provides interactive FTP-like access for exploring shares, while SMBMap offers non-interactive automated output for listing and downloading files. SMBClient is better for manual exploration and troubleshooting; SMBMap is better for scripting and automation. SMBClient supports upload (put); SMBMap has limited upload support. Both are part of the Samba ecosystem.

Can SMBClient work anonymously?

Yes, SMBClient supports anonymous (null session) access using the -N flag: smbclient -L //<target> -N. This tests whether shares allow unauthenticated access — a common security misconfiguration. Not all shares permit anonymous access; modern Windows systems often restrict null sessions. Always test anonymous access first before trying credentials.

How do I troubleshoot SMBClient?

Common fixes: 'connection refused' — verify SMB ports are open with Nmap. 'NT_STATUS_ACCESS_DENIED' — provide valid credentials or try a different share. 'NT_STATUS_LOGON_FAILURE' — check username/password and domain format (domain\user). 'NT_STATUS_BAD_NETWORK_NAME' — verify share name with -L listing. Use -d 3 for debug output to diagnose issues.

Is SMBClient legal to use?

SMBClient is legal when used with explicit written authorization on systems you own or have permission to test. Unauthorized SMB access is illegal under computer fraud laws (CFAA, Computer Misuse Act). Use SMBClient only in lab environments, CTF competitions, or authorized penetration testing engagements. Always obtain written consent before testing.

Can SMBClient connect without authentication?

Yes, use the -N flag for null session (anonymous) access: smbclient -L //192.168.1.1 -N. This tests whether SMB shares allow unauthenticated access. Not all shares permit anonymous connections — modern Windows systems restrict null sessions by default. Always test anonymous access first before attempting credential-based authentication.

Does SMBClient support Kerberos authentication?

Yes, use the -k flag to enable Kerberos authentication: smbclient //dc01/share -k CORP.USER@DOMAIN.COM. Kerberos authentication is required for many Active Directory environments and avoids sending plaintext passwords over the network. Ensure your system has a valid Kerberos ticket (obtain with kinit) before using -k.

What is the difference between SMBClient and smbmap?

SMBClient provides interactive FTP-like access for browsing and transferring files on SMB shares, while smbmap is a non-interactive tool designed for automated share enumeration and file listing across multiple hosts. SMBClient is better for hands-on exploration and file operations; smbmap is better for scripted reconnaissance and quick share mapping.

How do I browse files on an SMB share interactively?

Connect to the share: smbclient //192.168.1.1/share -U user%pass. Once connected, use 'ls' to list files, 'cd' to change directories, 'get' to download, 'put' to upload, and 'exit' to quit. Use 'help' to see all available commands. The interactive shell provides FTP-like commands for full share exploration.

How do I upload files to an SMB share?

Connect to the share with write permissions, then use 'put local_file.txt' to upload a single file. For bulk uploads: 'recurse on; mput *.txt'. Non-interactive upload: smbclient //host/share -U user -c 'put local.txt remote.txt'. If you receive NT_STATUS_ACCESS_DENIED, the share is read-only and you cannot upload.

Can SMBClient download entire shares recursively?

Yes, use tar archiving for bulk downloads: smbclient //host/share -N -c 'tarmode archive; tar c share.tar *'. This creates a tar archive of the entire share contents. For non-archived recursive download, use 'recurse on' then 'mget *'. The tar method is faster for large shares with many files and preserves directory structure.

How do I use SMBClient to list all available shares on a server?

Use the -L flag to list shares: smbclient -L //server -U user%password. This displays all shares including hidden and administrative shares (ADMIN$, C$, IPC$). For null session enumeration: smbclient -L //server -N. Share listings reveal the server's purpose and accessible resources for further exploitation.

Can SMBClient connect to SMBv1 servers?

Yes, SMBClient supports SMBv1, SMBv2, and SMBv3 protocols. By default it negotiates the highest available version. To force SMBv1: smbclient //server/share -U user -m SMB1. SMBv1 is insecure and vulnerable to EternalBlue (MS17-010), but may be required for legacy Windows XP/2003 systems in older environments.

How do I use SMBClient for lateral movement in Active Directory?

After compromising credentials, use SMBClient to access file shares across the domain: smbclient //dc01/SYSVOL -U domain_user%password. SYSVOL contains Group Policy Objects with potential cached credentials. NETLOGON share may contain login scripts. ADMIN$ provides remote access for PsExec-style lateral movement with tools like Impacket's psexec.py.

What is the difference between SMBClient and smbmap?

SMBClient is an interactive FTP-like client for manual share browsing and file operations. smbmap is an automated share enumeration tool that recursively lists files, identifies readable/writable shares, and searches for sensitive files across multiple hosts simultaneously. Use smbmap for initial discovery, SMBClient for targeted file access.

How do I use SMBClient with Pass-the-Hash authentication?

SMBClient supports NTLM hash pass-the-hash: smbclient //server/share -U user --pw-nt-hash <ntlm_hash>. This authenticates using the NTLM hash directly without knowing the plaintext password. Impacket's psexec.py and wmiexec.py provide more reliable Pass-the-Hash execution for remote command execution through SMB.

How do I use SMBClient with a Kerberos ticket?

First obtain a ticket with kinit user@DOMAIN.COM, then connect with the -k flag: smbclient //dc01/share -k DOMAIN.COM. Kerberos authentication avoids sending passwords over the network and is required for many Active Directory environments. Ensure your system clock is synchronized (Kerberos fails if clocks drift more than 5 minutes).

Can SMBClient delete files on a share?

Yes, if you have write and delete permissions. Connect to the share, then use: del filename.txt. You can also remove directories with rmdir folder_name. If you receive NT_STATUS_ACCESS_DENIED, the share or file permissions prevent deletion. Not all shares grant delete rights even if they allow reading.

How do I speed up SMBClient file downloads?

Use tar archiving instead of individual get commands: smbclient //host/share -N -c 'tarmode archive compress; tar c backup.tar *'. The compress option reduces network transfer. For multiple files, enable recurse on then mget *. Avoid downloading one file at a time — batch operations are significantly faster.

What is the difference between SMBClient and rpcclient?

SMBClient provides FTP-like file access to SMB shares, while rpcclient interfaces with Windows RPC services for user enumeration, group discovery, and policy extraction. They serve different purposes: use SMBClient for file operations, rpcclient for information gathering. Both are part of the Samba suite.

How do I find hidden shares on a Windows server?

Administrative shares (ADMIN$, C$, IPC$, and drive letter shares like D$) are hidden by default and do not appear in anonymous listings. Use authenticated listing: smbclient -L //server -U admin%password to see all shares including hidden ones. The IPC$ share is always present and useful for null session testing.

What does the SMBClient command do?

The smbclient command lets you access SMB/CIFS shares on Windows, Samba, and NAS devices from a terminal. Use -L to list visible shares, then connect to a share you have permission to use to browse folders, download files, or upload them.

Can Linux access a Samba share?

Yes. Run smbclient //server/share -U user on Linux and enter the password for an account with access. At the smb: \> prompt, use ls to list files or get to download a file you can read.

How do I access a Samba share from Windows?

Enter \\server\share in the File Explorer address bar. To map the share to drive Z: from Command Prompt, run net use Z: \\server\share /user:DOMAIN\user, or use the New-SmbMapping cmdlet in PowerShell. These options use the built-in Windows SMB client; to run Samba's smbclient command on Windows, use WSL.

What does 'SMB clients' mean?

SMB clients are programs that use SMB/CIFS to open shared folders on another computer. Examples include the built-in Windows SMB client used by File Explorer, Finder on macOS, and smbclient on Linux.

How do I use SMBClient on Windows?

There is no native Windows smbclient binary. Run wsl --install in PowerShell, then open an Ubuntu or Debian WSL session. Inside WSL, run sudo apt update && sudo apt install smbclient and verify with smbclient --version. If you only need to open a share, use File Explorer or net use without WSL.

What is an SMBClient?

SMBClient is Samba's FTP-like command-line client for SMB/CIFS shares. It lets you list shares, browse folders, and upload or download files when you have permission.

How do I install SMBClient?

Kali Linux normally includes it; run smbclient --version to check or 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. On Windows, run wsl --install and use the Debian or Ubuntu apt command inside WSL.

How do I use SMBClient in Kali Linux?

Kali Linux normally includes smbclient; verify with smbclient --version. For a host you own or have explicit written authorization to test, run smbclient -L //target -N to see which shares are visible without a password prompt. Connect to a permitted share with smbclient //target/share -U user, then run ls at the prompt.

How do I download an entire share recursively with SMBClient?

Connect to the root of a share you are authorized to copy and run recurse if recursion is off. Run mask * and then mget * to download readable files through the directory tree, answering any confirmation prompts. Use mask *.ext instead of mask * to select one file extension, or run tar c backup.tar from the share root to save a large share as an uncompressed local archive.

Why do I get NT_STATUS_BAD_NETWORK_NAME with SMBClient?

This usually means the server does not recognize the share name. Connect to the share root with smbclient //server/share -U user rather than using //server/share/subfolder, then run cd subfolder at the prompt. Use smbclient -L //server -U user to check the exact share names visible to your account.

Tags

#smb-client#smb-enumeration#file-sharing#samba#file-transfer#windows-networking#share-access#network-enumeration#reconnaissance#linux-tool#smb-cifs#null-session

Output Explanation

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.

Ethical Usage Notice

This tool is designed for authorized security testing, educational purposes, and legitimate network administration only. Unauthorized access to computer systems is illegal.