How to configure Samba Server share on Ubuntu 20.04 Focal Fossa Linux -

The objective of this tutorial is to configure a basic Samba server to share user home directories as well as provide read-write anonymous access to selected directory. There are myriads of possible other Samba configurations, however the aim of this guide is to get you started with some basics which can be later expanded to implement more features to suit your needs.
This is a companion discussion topic for the original entry at


I am following the guide but at this point:

smbpasswd -a linuxconfig

I enter the password but then get the following:

Failed to add entry for user linuxconfig.

Any assistance would me much appreciated

Hi MorphZan,

Welcome to our forums.

While the tutorial uses the “linuxconfig” user as an example, it also states that it must be an existing user on your system. Did you create the user as described at the beginning of step 3 of the tutorial before running smbpasswd against it?

Awesome and easy to follow. i had issues on ubuntu 18 but this worked first go. Cheers!

Hi. Thanks for nice explanation. MY host machine is Windows 10 and I am using Ubuntu 20.04 on my virtual machine. My user name for VM & Samba server is same but password is different. I was able to follow and do the steps till Step 9 , but I struck at Step 10 on wards. I am not clear on what details need to be entered while mapping the network drive and what credentials to be used. I tried all possible combinations but unable to get it work. I am not clear on how to get the details for “Samba server IP address or hostname followed by the name of the user’s home directory.” Please help me in understanding the step clearly.

I am unable to access my ubuntu files or folder from windows 10.
Please help me and how to fix it.

Here are configuration I did on the smb.conf file.

comment = Home Directories
browseable = yes
read only = no
create mask = 0700
directory mask = 0700
valid users = %S
comment = public anonymous access
path = /home/shamir/SMB
browsable =yes
create mask = 0660
directory mask = 0771
writable = yes
guest ok = yes

I fixed this issue by following.

sudo useradd testsuer
sudo smbpasswd -a testuser

@Lubos Hello; so how to “share” a folder within the Host PC on Ubuntu? I do have a Folder within another hard drive /media/userx/Main_Media_4/Cloud_Folders_1/ and when I look under Properties > Permissions > Ownership > Groups, it is under userx, yet there is another option for “sambashare”. I would not like to change the owndership since there are other sync programs are already syncing to the hard drive (assumingly under userx Group) Thanx