Linux Network

smbclient – Access Windows Share and Samba Share

smbclient
smbclient

With smbclient you can connect to Windows Share or Samba share that are available on your network using command line interface. SMBclient works upon the simple message block protocol developed by IBM. You don’t need samba server running on your machine for smbclient to work. It comes preinstalled in all modern-day Linux distros. Connecting to a network shared location is relatively easy on windows but we will be doing this task on Linux.

Also Check: 5 Best Open Source NAS Server

First, We generally want to list the shares that are available. To list Share you use the following command.

#smbclient -L //IP-Address -N -U ajay

This command will list all the shares that are available at given IP address. Here -U argument stands for user and -N stands for No password respectively. If you wish to use no username with no password, don’t use -U option.

List Samba Shares

Once you have decided to which share you want to connect to, use the following command.

#smbclient //IP-Address/Share -N -U ajay

Now you’ll be connected to a selected network share location as shown in the picture below. Depending upon the security parameters of the samba share or windows share, it might be necessary for you to enter the password or you will be denied access. You can also use just host-name instead of  IP address of the machine on which samba share or windows share exist.

Connected

Another useful tool that you can use is smbtree. Just open the terminal and enter the command

#smbtree

This command will list all the windows share or samba share available on your network.

This will only list the windows share and samba share with host-name. In order to know their IP address as well, you can employ another tool called nm-lookup. You just need to enter the command nm-lookup followed by the host-name and it will return the IP address of that machine.

#nm-lookup host-name

There are other variety of other options available for smbclient as well, which you can use according to your need. Please look up the man page for smbclient for more tweaked settings.

About the author

Ajay Verma

A Computer Science Graduate, who works extensively on open source projects. His Areas Of interest are: Network Security, Linux Administration, FOSS, Python, and C programming.

Add Comment

Click here to post a comment