smbclient

Description

smbclient is a client that can ‘talk’ to an SMB/CIFS server. It offers an interface similar to that of the ftp program. Operations include things like getting files from the server to the local machine, putting files from the local machine to the server, retrieving directory information from the server and so on.

Usage

Tool Usage:

Usage: smbclient service <password>
  -R, --name-resolve=NAME-RESOLVE-ORDER     Use these name resolution services only
  -M, --message=HOST                        Send message
  -I, --ip-address=IP                       Use this IP to connect to
  -E, --stderr                              Write messages to stderr instead of stdout
  -L, --list=HOST                           Get a list of shares available on a host
  -m, --max-protocol=LEVEL                  Set the max protocol level
  -T, --tar=<c|x>IXFvgbNan                  Command line tar
  -D, --directory=DIR                       Start from directory
  -c, --command=STRING                      Execute semicolon separated commands
  -b, --send-buffer=BYTES                   Changes the transmit/send buffer
  -t, --timeout=SECONDS                     Changes the per-operation timeout
  -p, --port=PORT                           Port to connect to
  -g, --grepable                            Produce grepable output
  -q, --quiet                               Suppress help message
  -B, --browse                              Browse SMB servers using DNS
 
Help options:
  -?, --help                                Show this help message
      --usage                               Display brief usage message
 
Common samba options:
  -d, --debuglevel=DEBUGLEVEL               Set debug level
  -s, --configfile=CONFIGFILE               Use alternate configuration file
  -l, --log-basename=LOGFILEBASE            Base name for log files
  -V, --version                             Print version
      --option=name=value                   Set smb.conf option from command line
 
Connection options:
  -O, --socket-options=SOCKETOPTIONS        socket options to use
  -n, --netbiosname=NETBIOSNAME             Primary netbios name
  -W, --workgroup=WORKGROUP                 Set the workgroup name
  -i, --scope=SCOPE                         Use this Netbios scope
 
Authentication options:
  -U, --user=USERNAME                       Set the network username
  -N, --no-pass                             Don't ask for a password
  -k, --kerberos                            Use kerberos (active directory) authentication
  -A, --authentication-file=FILE            Get the credentials from a file
  -S, --signing=on|off|required             Set the client signing state
  -P, --machine-pass                        Use stored machine account password
  -e, --encrypt                             Encrypt SMB transport
  -C, --use-ccache                          Use the winbind ccache for authentication
      --pw-nt-hash                          The supplied password is the NT hash

SMB Shell Usage:

?              allinfo        altname        archive        backup        
blocksize      cancel         case_sensitive cd             chmod         
chown          close          del            deltree        dir           
du             echo           exit           get            getfacl       
geteas         hardlink       help           history        iosize        
lcd            link           lock           lowercase      ls            
l              mask           md             mget           mkdir         
more           mput           newer          notify         open          
posix          posix_encrypt  posix_open     posix_mkdir    posix_rmdir   
posix_unlink   posix_whoami   print          prompt         put           
pwd            q              queue          quit           readlink      
rd             recurse        reget          rename         reput         
rm             rmdir          showacls       setea          setmode       
scopy          stat           symlink        tar            tarmode       
timeout        translate      unlock         volume         vuid          
wdel           logon          listconnect    showconnect    tcon          
tdis           tid            utimes         logoff         ..            
!

Examples

smbclient -L <ip> -U <user>

This command will establish an SMB session with the server and list the shares.

smbclient \\\\<ip>\\<share> [password]

This will connect to the remote share and return an interactive smb prompt.

└──╼ [★]$ smbclient \\\\10.129.152.222\\WorkShares
Enter WORKGROUP\htb-403knowledge's password:
Try "help" to get a list of possible commands.
smb: \>

Blog Posts