Linux find or look for available smb shares on a server

So how do you find out share name from Linux command line? Let us say you’ve few more servers running:

ADVERTISEMENTS

=> Windows 2000 server

=> Redhat Enterprise Linux 4.0

How do you list or look for available share on a server?

Linux comes with command called smbclient. It is a ftp-like client to access SMB/CIFS resources on servers or workstations. It offers an interface similar to that of the ftp command. 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.

It has special option called -L. This option allows you to look at what services and shares are available on a server.

Task: Find smb share name from Linux and UNIX shell prompt

If your server name is jumbo (NetBIOS name) type:
$ smbclient -L jumbo -Uusername
OR
$ smbclient -L jumbo -Uusername -I ip-address

Domain=[NAS02] OS=[Unix] Server=[Samba 3.0.21a]

        Sharename       Type      Comment
        ---------       ----      -------
        ADMIN$          IPC       IPC Service (SAMBA-LDAP Server)
        IPC$            IPC       IPC Service (SAMBA-LDAP Server)
        docs                 Disk      Home Directories
        Sales                Disk      Home Directories
Domain=[NAS02] OS=[Unix] Server=[Samba 3.0.21a]

        Server               Comment
        ---------            -------

        Workgroup            Master
        ---------            -------
        OFFICE                   LDAP01

Docs and Sales are two share name for my office NAS02 server.

It may prompt for a password and a list should appear on screen . The -I option may be useful if your NetBIOS names don’t match your TCP/IP DNS host names or if you are trying to reach a host on another network.

For more information refer to smbclient man page:
man smbclient

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source & DevOps topics via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
3 comments… add one
  • Jonathan May 31, 2012 @ 14:12

    I don’t know what possible servers are in my network. How can I find all available servers and shares?

  • droope Oct 11, 2012 @ 23:19

    Hi Jonathan.

    I just put the ip address of the windows machine I wanted to get access to.

    Cheers!
    Pedro

  • murthy Sep 26, 2013 @ 6:47

    Hi,

    The findsmb command not showing up anything on SMB server running RHEL 6.3. However, I’m able to connect to the share from other RHEL 6.3 systems on same subnet.

    Thanks
    mssm

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.