smbclient
TLDR
Connect to a share
SYNOPSIS
smbclient //server/share [OPTIONS]
DESCRIPTION
smbclient is an FTP-like client for accessing SMB/CIFS network shares. It connects to Windows file servers and Samba shares, enabling file transfers, directory operations, and share browsing from the command line.
The tool supports interactive sessions with FTP-style commands or batch operations via -c flag. It can create tar backups of shares and browse available network resources.
PARAMETERS
-U, --user username[%password]
Specify username and optional password-W, --workgroup domain
Set SMB workgroup/domain-N, --no-pass
Suppress password prompt for anonymous access-L, --list host
List available shares on server-D, --directory path
Change to initial directory on connection-c, --command commands
Execute semicolon-separated commands-I, --ip-address ip
Specify server IP directly-p, --port port
TCP port (default: 139 or 445)-m, --max-protocol level
Maximum SMB protocol (NT1, SMB2, SMB3)-A, --authentication-file file
Read credentials from file-T, --tar options
Tar backup mode with flags-d, --debuglevel level
Debug verbosity (0-10)-n, --netbiosname name
Override client NetBIOS name
INTERACTIVE COMMANDS
get remote [local]
Download file from shareput local [remote]
Upload file to sharels [pattern]
List directory contentscd directory
Change remote directorylcd directory
Change local directorymkdir directory
Create remote directoryrm file
Delete remote fileexit
Close connection
CAVEATS
Password on command line is visible in process listings; use -A for credentials file. Some features require specific SMB protocol versions. Firewall rules may block SMB ports (139, 445). NTLM authentication is being deprecated in favor of Kerberos.
HISTORY
smbclient is part of Samba, created by Andrew Tridgell in 1992 after reverse-engineering the SMB protocol. Samba has evolved to support modern SMB2 and SMB3 protocols. The tool remains essential for cross-platform file sharing and accessing Windows shares from Linux.
SEE ALSO
mount.cifs(8), smbcacls(1), smbget(1), nmblookup(1)


