Samba (File Server) - List Samba shares using the smbclient command

by
Jeremy Canfield |
Updated: January 16 2023
| Samba (File Server) articles
On a Debian distribution (Mint, Ubuntu), apt-get install can be used to install samba-client (which includes the smbclient command). On a Red Hat distribution (CentOS, Fedora, Red Hat), dnf install or yum install can be used.
dnf install samba-client
The smbclient command with the -L or --list option can be used to list the current shares. By default, when the -U or --user option is not included, the logon will be performed as a guest. If guest logins are permitted, something like this should be returned.
In this example, the "share" directory is being shared.
~]# smbclient --list $(hostname -s)
Enter SAMBA\GUEST's password: Anonymous login successful
Sharename Type Comment
--------- ---- -------
share Disk
IPC$ IPC IPC Service (Samba 4.12.2)
SMB1 disabled -- no workgroup available
Or, the -U or --user option can be included to login as a specific user.
smbclient --list //$(hostname -s)/share --user john.doe
Did you find this article helpful?
If so, consider buying me a coffee over at