How To Setup Samba on Ubuntu Workstation

If you want to be connected with your workstation either from command line or your File Manager (e.g. from another computer in your LAN, Linux, Windows or Mac), install Samba.

According to Official Samba Guide:

Samba is software that can be run on a platform other than Microsoft Windows, for example, UNIX, Linux, IBM System 390, OpenVMS, and other operating systems. Samba uses the TCP/IP protocol that is installed on the host server. When correctly configured, it allows that host to interact with a Microsoft Windows client or server as if it is a Windows file and print server.

Please, note that this guide concerns Local Networds and NOT public servers. For advanced configuration, read carefully the Official Samba How-To.

Install Samba server and client

Open a Terminal and type:

sudo apt-get install samba smbclient

Define share folder (eg /data)

Edit configuration file

sudo nano /etc/samba/smb.conf

add

[data]
path=/data
writable=yes
browsable=yes

Add a samba user

Open a Terminal and type:

sudo pdbedit -a -u your-username

Restart Samba

From the command line:

sudo systemctl restart smbd.service
sudo systemctl restart nmbd.service

Now you can access Samba Shares using Nautilus (the Ubuntu file Manager), by pressing “Network”.

Of course you can use any file manager (Linux or Mac)

smb://ServerName/ShareName

e.g.

smb://192.168.1.51/data

Connect from file manager (Microsoft Windows)

\\ServerName\ShareName

e.g.

\\192.168.1.51\data

Use CIFS with Samba (recommended)

Additionally, you have the option to use CIFS with Samba, which is more advanced.

According to Official Samba Documentation:

The in-kernel CIFS filesystem is generally the preferred method for mounting SMB/CIFS shares on Linux. The in-kernel CIFS filesystem relies on a set of user-space tools. That package of tools is called cifs-utils. Although not really part of Samba proper, these tools were originally part of the Samba package. For several reasons, shipping these tools as part of Samba was problematic and it was deemed better to split them off into their own package.

Setup cifs-utils to any (Linux) computer which will try to access a shared folder in a samba server:

sudo apt-get install cifs-utils

Mount a share from command line:

sudo mount -t cifs //192.168.1.51/data /mnt/data -o user=USERNAME

(will ask for password)

Then use the file manager to access your share (eg /mnt/data). That’s all!

To unmount this share:

sudo umount /mnt/data

Your comments are welcome!


Never Miss A Post!

Subscribe to our free NewsLetter