smbget
Download files from SMB/CIFS shares
TLDR
Download a file from a server
Download a share or directory recursively
Connect with a username and password
Require encrypted transfers
SYNOPSIS
smbget [options] URL
PARAMETERS
-b
Binary transfer mode (default).
-d DEBUGLEVEL
Set debug level (0-10).
-h
Display help and exit.
-n
No prompt. Useful for scripts.
-o filename
Output filename. If not specified, the filename from the URL will be used.
-r
Recursive mode. Download directories and their contents.
-R
Resume incomplete downloads.
-U username[%password]
Username for authentication. Password may be specified or prompted for.
-v
Verbose mode.
-V
Print version information and exit.
DESCRIPTION
The smbget command is a versatile tool used to download files and directories from SMB/CIFS (Server Message Block/Common Internet File System) shares, commonly used on Windows networks. It acts as a simple wget-like utility but specifically designed for SMB/CIFS protocols. Unlike more complex tools like `smbclient`, smbget provides a streamlined way to retrieve files without requiring interactive sessions or elaborate configurations for basic file retrieval.
It's often employed in scripts or automated tasks where fetching files from an SMB share is a necessity. smbget uses the credentials from the user executing the command, or can take specific credentials.
The tool supports features like automatic filename generation, recursive directory downloading, and authentication options. The command is usually available within the `samba` packages or a related samba client suite.
CAVEATS
smbget requires the `samba-client` package to be installed. It may not be as robust as `smbclient` for complex scenarios or when handling very large file transfers. Ensure the SMB share is properly configured with appropriate permissions to avoid access errors.
URL must be a valid SMB share URL. Check the URL format before execution.
When using the recursive option be mindful of large directories since smbget reads all files and directories at once and may run into resource limitations.
URL FORMAT
The URL should be in the form: smb://server/share/path/to/file. For example: smb://example.com/public/mydata.txt