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 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)




Connect from file manager (Microsoft Windows)




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 // /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