Simple setup using Samba server to share files with Windows clients

Hello :smiley:

I am writing this post to show how to setup a simple File server to share files with Windows PC.
this is the first Arch based distro which i am using for more than 2 weeks.
until i almost gave up trying to configure Samba and decided to go back to ubuntu/opensuse as the help docs are very simple whereas Arch Wiki has a complex info on Samba config.
which will scare a intermediate level Home user.

so, this is what worked for me and am still staying with EndeavourOS! :heart_eyes:

Installation

sudo pacman -S samba gvfs-smb --needed

Configuration

as quoted in Arch Wiki " Because the samba package does not provide this file, one needs to create it before starting smb .service."
so lets create smb.conf file

sudo leafpad /etc/samba/smb.conf

my smb.conf file looks as below, simple but gets the work done.

[global]
workgroup = WORKGROUP
security = user

[mj]
comment = EndeavourOS-server
    path = /home/mj
    browsable = yes
    read only = no
    create mask = 0755
    valid users = @mj

the workgroup specified in the [global] section has to match the Windows workgroup (default WORKGROUP ) , i have not changed the windows workgroup hence its stays as default.

next i need my Home partition on EnOS to be accessible from Windows.

  • [mj] - is my home folder name which i wish to use as shared-folder
  • Comment - short description.
  • path - path of the folder to be shared. i.e mj
  • browsable - enter yes if you want to browse directories using windows explorer from windows.
  • read only - if value is ‘yes’ then share is read only, if value is ‘no’ then its writable.
  • create mask - set file permissions, i used Owner will rwx, group and others will only rx.
  • valid users - Users/groups who can connect to a share

next, create a group sambashare and add user to group.
sudo groupadd -r sambashare
sudo gpasswd -a mj sambashare

Now configure firewall.
open UFW and allow samba service. click add rules and search for smb and you should have ports and configs readily available.
Screenshot_2020-03-01_17-46-13

now start smb service.
sudo systemctl enable smb nmb
sudo systemctl start smb nmb
if any issue restart the services.

now from windows you should be able to browse the home folder on linux.
you can access the server from windows by \\ip address\shared-folder

below are few screens on how to add the shared directory to Windows explorer.

1
2
3
4
enter user name and password when prompted.
5
6
7

finally i am able to access my home folder on Enos from windows and other PC’s
:star_struck: :star_struck: :star_struck: :star_struck: :star_struck:

11 Likes

works like a charm, thanks a ton madhu :+1:

1 Like

Thanks a lot. Following the tutorial from the endeavour os docs didn’t help… and most of the “How to” guides were trash…
This was simple and the most efficient way to “Just get it working and started” guide that I came across.

Just like how most tutorial didn’t help me and finally a simple guide from ubuntu official docs that would take only 2-3 minutes just worked for my Pop_OS previously.

Though I would like to add another point to it. This works for fresh install. But, I tried another tutorial and got errors, try removing all the packages what you installed from the previous tutorials with pacman/yay -Rns “Package names” and then try this tutorial. Cause, this is what worked for me.

Again thanks a lot for sharing. :grin:

1 Like

Another thing that I found out is that if you are using KDE, you can just install the relevant File Sharing package that KDE provides along with the Samba Package. Just right click on any folder, and navigate to the Share Tab in Properties. You should be able to share files easily.

  1. Install kde-filesharing I think that is the name
  2. Install Samba package
  3. Right click and go to properties on the file that you wish to share
  4. Simple allow the file to be shared by navigating to the share tab and then allowing it to be shared.

I hope this helps someone who is using KDE.

This requires /var/lib/samba/usershares to be set up, which this samba config does not have. You have to manually create the folder.