Browse SMB/CIFS shares under Linux with smbclient

As an admin, one often wants to find out whether CIFS shares can be addressed under Linux or whether these have been created correctly in terms of authorization.

The Linux program smbclient is suitable for this purpose. It works on a console basis and thus checks can be carried out here, e.g. by scripts.

A list of possible releases of a host is requested using the following command:

smbclient -L -U admin

An output, in this case on the host mm with the user mm, looks something like this:

aw@mm:~$ smbclient -L mm -U mm
WARNING: The "syslog" option is deprecated
Enter mm's password:
Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.5.16-Debian]

        Sharename       Type      Comment
        ---------       ----      -------
        storage         Disk      Storage
        dokumente       Disk      Dokumente
        mm              Disk      Multimedia
        elearning       Disk      eLearning
        IPC$            IPC       IPC Service (mm server)

If you want to connect to a share, you call the command smbclient as follows:

smbclient //mm/mm -U admin

In this case, the share mm is called on the host mm based on the user admin. The command does not end but you are now in a special “Browsing” mode which is indicated by the prompt smb: \>.

In “Browsing” mode you move with the cd command to switch to directories or ls to display the content of the current directory.

With the commands get and put files can be downloaded or uploaded via CIFS.

You don’t need more to be able to determine whether access via CIFS is possible and whether you can access the necessary resources in terms of authorization.

Created on June 3, 2022 by Andreas Wittmann

Home - Sitemap - Privacy-policy/Impressum

Coypright 2024 by Andreas Wittmann
All rights reserved