Last Updated: 8/28/2022
Samba is designed for Unix like systems to provide file and print services to to windows clients. You can run Samba as a client to reach Windows resources or as a service to provide this functionality to Windows clients.
SAMBA Client:
apt install samba-client samba-common -y
Now let’s see what client shares are available. (and presuming you have a /mnt/share)
smbclient -U user -L 192.168.1.100
Knowing that, let’s make use of it.
# mount -t cifs -o username=user //192.168.1.100/python /mnt/share
Password for user@//192.168.1.100/python: ********
If this is an older machine or a NAS (Netgear etc) you may see something like:
root@server1:/home/user/dev# smbclient -U user -L 192.168.1.100
protocol negotiation failed: NT_STATUS_CONNECTION_DISCONNECTED
This is a sign that you are working with some older protocols and you are going to need to do a little editing to enable negotiation with older protocols. In this case you would need to edit:
/etc/samba/smb.conf
You would want to add the following under the [global] section.
client min protocol = NT1
Now you are ready to test again:
root@server1:/etc/samba# smbclient -L \\192.168.1.100
Enter WORKGROUP\user's password:
Sharename Type Comment
--------- ---- -------
IPC$ IPC IPC Service (nas9)
youtube Disk
python Disk
Reconnecting with SMB1 for workgroup listing.
Server Comment
--------- -------
Workgroup Master
--------- -------
WORKGROUP NAS9
We are now ready to mount the drive! When doing so we we might get something like
mount: /mnt/python: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.
Which means we don’t have the ability to manage CIF yet so we need to install:
sudo apt-get install cifs-utils
Now we are ready to try again. Also, In this example problem we were connecting to an older NAS, when running mount this may present a problem. While using “mount” you may need to add a parameter specifying your preference to connect using the older SMB1.
mount -t cifs -o vers=1.0 //192.168.1.100/python /mnt/python
Please see the articled “Samba Server” to learn how to install and administrate a samba server.