Skip to content

smbclient

60 commands

An FTP-like client for SMB/CIFS shares: list shares, browse, upload and download files, with or without credentials.

  • SMB
  • file shares

Install smbclient

sudo apt install smbclient

Share Enumeration3

smbclient -L //192.168.1.10 -N

Lists available shares on the target using a null session (no authentication).

smbclient -L //192.168.1.10 -U guest%

Lists shares using the guest account with a blank password.

smbclient -L //192.168.1.10 -U username

Lists shares prompting for a password for the specified user.

Link

Basic Connection2

smbclient //192.168.1.10/share -N

Connects to a specific share using a null session.

Link
smbclient //192.168.1.10/share -U username%password

Connects to a share providing both username and password inline.

Link

Domain Authentication1

smbclient //dc.example.local/share -W DOMAIN -U user

Connects to a share authenticating against a specific Windows domain or workgroup.

Link

Authentication1

smbclient //192.168.1.10/share -A authfile.txt

Uses a file containing username, password, and domain for authentication to avoid CLI logging.

Link

Kerberos Authentication2

smbclient -k //dc.example.local/share

Connects using an existing Kerberos ticket (ccache) instead of a password.

Link
smbclient -k -L //dc.example.local

Lists shares using Kerberos authentication.

Link

Connection Options2

smbclient //192.168.1.10/share -p 445

Forces the connection to use TCP port 445 explicitly.

Link
smbclient //192.168.1.10/share -p 139

Forces the connection to use NetBIOS over TCP port 139.

Link

Target Specification1

smbclient //hostname/share -I 192.168.1.10

Connects to a hostname but overrides the destination IP address (useful for DNS spoofing/testing).

Link

NetBIOS1

smbclient //192.168.1.10/share -n NETBIOS_NAME

Sets the NetBIOS name of the client source machine during the handshake.

Link

Protocol Selection3

smbclient //192.168.1.10/share -m SMB2

Forces the client to use the SMB2 protocol version max.

Link
smbclient //192.168.1.10/share -m SMB3

Forces the client to use the SMB3 protocol version max (often required for newer Windows).

Link
smbclient //192.168.1.10/share -m NT1

Forces the use of NT1 (SMB1), useful for targeting legacy Windows XP or Server 2003 systems.

Link

Interactive Mode1

smbclient //192.168.1.10/share

Starts an interactive shell session where you can type commands like ls, get, and put.

Link

Command Execution1

smbclient //192.168.1.10/share -c 'ls'

Connects, lists the files in the root directory, and disconnects immediately.

Link

File Retrieval1

smbclient //192.168.1.10/share -c 'get sensitive.docx'

Connects and downloads a specific single file non-interactively.

Link

File Upload1

smbclient //192.168.1.10/share -c 'put payload.exe'

Connects and uploads a file to the remote share.

Link

Directory Management1

smbclient //192.168.1.10/share -c 'mkdir tempdir'

Creates a new directory on the remote share.

Link

Recursive Operations1

smbclient //192.168.1.10/share -c 'recurse; ls'

Toggles recursion to ON and lists all files in the share including subdirectories.

Link

Recursive Download1

smbclient //192.168.1.10/share -c 'prompt OFF; recurse ON; mget *'

Downloads the entire contents of a share recursively without asking for confirmation per file.

Link

File Deletion2

smbclient //192.168.1.10/share -c 'del oldfile.txt'

Deletes a specific file from the remote share.

Link
smbclient //192.168.1.10/share -c 'rmdir old_folder'

Removes an empty directory from the remote share.

Link

File Reading1

smbclient //192.168.1.10/share -c 'more readme.txt'

Displays the contents of a remote file directly to stdout.

Link

Archive Operations2

smbclient //192.168.1.10/share -T c backup.tar *

Creates a local TAR archive of all files on the remote share directly.

Link
smbclient //192.168.1.10/share -T x restore.tar

Extracts a local TAR archive and uploads the files to the remote share.

Link

Debug & Logging1

smbclient //192.168.1.10/share -d 5

Increases the debug level to 5, showing detailed protocol handshake and error information.

Link

Connection Control1

smbclient //192.168.1.10/share -t 60

Sets the connection timeout in seconds (useful for slow links or large transfers).

Link

Misc Options1

smbclient //192.168.1.10/share -g

Uses grepable output format, useful for parsing results in scripts.

Link

Messaging1

smbclient -M NETBIOS_NAME

Sends a WinPopup message to the target machine (requires Messenger service).

Link

IPv6 Connection1

smbclient //ipv6-address/share -U user

Connects to an SMB share hosted on an IPv6 address.

Link

System Info1

smbclient //192.168.1.10/IPC$ -c 'q'

Connects to IPC$ (Inter-Process Communication) merely to validate access rights or null session capability.

Link

Permissions2

smbclient //192.168.1.10/share -c 'getfacl filename'

Displays the Access Control List (ACL) and permissions for a specific file (if server supports UNIX extensions).

Link
smbclient //192.168.1.10/share -c 'stat filename'

Shows file attributes, timestamps, and size information.

Link

File Operations1

smbclient //192.168.1.10/share -c 'rename old new'

Renames a file on the remote server.

Link

Advanced Config1

smbclient //192.168.1.10/share -O 'socket options'

Sets TCP socket options for performance tuning or stability.

Link

Scripting1

smbclient //192.168.1.10/share -E

Writes messages to stderr instead of stdout, keeping stdout clean for data piping.

Link

Directory Navigation1

smbclient //192.168.1.10/share -D directory

Starts the session directly inside a specific subdirectory within the share.

Link

IO Control1

smbclient //192.168.1.10/share -b size

Changes the transmit/send buffer size (useful for performance tuning on specific networks).

Link

Config File1

smbclient -s /etc/samba/smb.conf

Uses a specific local Samba configuration file instead of the default.

Link

Interactive2

smbclient //192.168.1.10/share -c 'history'

Displays the command history within the smbclient context (mostly useful in interactive mode).

Link
smbclient //192.168.1.10/share -c 'volume'

Prints the volume serial number of the remote share.

Link

File Integrity1

smbclient //192.168.1.10/share -c 'md5 filename'

Calculates MD5 hash of a remote file (if supported by server/client extensions).

Link

Red Team2

smbclient //192.168.1.10/C$ -U user

Connects to the administrative C$ share, typically allowing full filesystem access.

Link
smbclient //192.168.1.10/ADMIN$ -U user

Connects to the ADMIN$ share, often used for remote execution and PsExec-style attacks.

Link

Path parsing1

smbclient \\192.168.1.10\share -U user

Connects using Windows-style backslashes (must be escaped in shell).

Link

Quiet Mode1

smbclient //192.168.1.10/share -q

Suppresses informational messages, useful for scripts expecting clean output.

Link

Advanced3

smbclient //192.168.1.10/share -c 'posix'

Turns on POSIX path handling to allow case-sensitive filenames if server supports it.

Link
smbclient //192.168.1.10/share -c 'case_sensitive'

Toggles case sensitivity for file matching.

Link
smbclient //192.168.1.10/share -c 'l'

Alternative command for 'ls' (list) inside the interactive shell.

Link

Printing1

smbclient //192.168.1.10/print$ -c 'print file.pdf'

Uploads and queues a file to be printed on a remote printer share.

Link

Offline1

smbclient //192.168.1.10/share -c 'logon'

Establishes a new logon context (re-authenticates) within the session.

Link

Resolve Order1

smbclient //hostname/share -R lmhosts

Sets the name resolution order (e.g., lmhosts, host, wins, bcast).

Link

Encryption1

smbclient -e //192.168.1.10/share

Forces SMB encryption (SMB3) for the connection, protecting data on the wire.

Link

File Ops1

smbclient //192.168.1.10/share -c 'du'

Displays disk usage for the current share.

Link

Batch1

echo 'ls' | smbclient //192.168.1.10/share

Pipes commands directly into smbclient from stdin (alternative to -c).

Link

Enumeration1

smbclient -L 192.168.1.10 -I 192.168.1.10

Enumerates shares when the NetBIOS name is unknown or identical to IP.

Link

Archive1

smbclient //192.168.1.10/share -D folder -T c archive.tar

Changes directory to a subfolder first, then creates a tar archive of its contents.

Link