SAMBA FILE SHARING HOWTO FOR ANTERGOS (and not only!)
by Flavio Antonini – 2016 – last update: june 11 2016
- ~ edited by joekamprad (january 2018)
- ~ edited by joekamprad | formatting shorten and expand | (march 2018)
- ~ Note: In samba 4.8.0-1, the units were renamed from smbd.service and nmbd.service to smb.service and nmb.service.
- ~ last edited by joekamprad (change yaourt to yay)
Installation:
Install samba and needed apps:
sudo pacman -S samba nautilus-share gnome-user-share gvfs-smb
stop the samba smb nmb services…
sudo systemctl stop samba smb nmb
Configuration:
verify if smb.conf file exist…
ls /etc/samba
if not then copy the file examples/smb.conf from https://git.samba.org to smb.conf (this fix also sharing printer troubleshooting)…
Just take this content.
https://git.samba.org/samba.git/?p=samba.git;a=blob_plain;f=examples/smb.conf.default;hb=HEAD
and place the file in /etc/samba/smb.conf
Under GNOME you need to put off sharing personal files like this:
switch OFF Sharing Personal Files on Sharing under System Settings…
System Settings –> Sharing –> Sharing Personal Files –> OFF
create a group sambashare…
sudo groupadd -r sambashare
create usershare folder…
sudo mkdir -p /var/lib/samba/usershare
change group of usershare folder…
sudo chown root:sambashare /var/lib/samba/usershare
change mode w/sticky bit on usershare folder…
sudo chmod 1770 /var/lib/samba/usershare
verify if your user is in samba DB…
sudo pdbedit -L -v
if not then add your user to samba (then create new sharing password)…
sudo smbpasswd -a <your-user>
if you would prefer to use tdbsam rather than smbpasswd:
sudo pdbedit -a -u <your-user>
then add you user to sambashare group:
sudo gpasswd -a <your-user> sambashare
edit smb.conf…
sudo gedit /etc/samba/smb.conf
Use editor you want instead of gedit nano will be easy to and runs inside terminal.
uncomment following line in /etc/samba/smb.conf file under [global] settings section…
include = /etc/samba/smb.conf.%m
if you are using tdbsam rather than smbpasswd uncomment the line in /etc/samba/smb.conf file under [global] settings section…
passdb backend = tdbsam
add following lines at the end of [global] section of smb.conf file then save file and exit gedit…
usershare path = /var/lib/samba/usershare usershare max shares = 100 usershare allow guests = yes usershare owner only = yes
Starting:
make sure following services are enabled (to start at boot):
sudo systemctl enable samba smb nmb
Firewall:
If you use a firewall (what is recommended!) then you must set a couple of ports to allow the Netbios service (nmbd) to reach your PC.
Check if you have gufw installed…
pacman -Qs gufw
if not then install it…
sudo pacman -S gufw
then enable it…
sudo systemctl enable gufw
Now you must enable the firewall following ports related to nmbd service:
137/udp to everyone
138/udp to everyone
and following ports related to smbd service:
139/tcp to everyone
445/tcp to everyone
For firewall settings and troubleshooting see internet documentations:
https://help.ubuntu.com/community/Gufw (except for installation instructions that concern to ubuntu!!).
Now reboot system…
For Gnome:
then, when your system is ready, try to open nautilus (Files)
choose a folder to share, right click on it, then
choose Properties –> Sharing and check Sharing this folder…
now – for test – view network resource in nautilus, click on icon with
your PC name, click on it, then click on shared folder and enter
the sharing password previously set…
…and joy
For XFCE:
For XFCE use thunar and make sure you have package: thunar-shares-plugin installed…
As we figure out here it works for XFCE:
https://forum.antergos.com/topic/9082/xfce-samba-does-not-work-and-needs-too-much-configuration
System Config Samba:
- The Samba configuration tool by Red Hat
is also working onto ARCH and Antergos:
https://aur.archlinux.org/packages/system-config-samba/
Build and install from AUR:
yay -S system-config-samba
Get config aviable:
https://git.samba.org/samba.git/?p=samba.git;a=blob_plain;f=examples/smb.conf.default;hb=HEAD
copy from the webside and paste inside the file:
sudo nano /etc/samba.conf
save with [Ctrl+X]
then start and enable (to get it started automatic on bootup)
sudo systemctl start samba smb nmb sudo systemctl enable samba smb nmb
Now you can use system-config-samba!
Notes:
1) Sometimes sharing is not immediately, and take some time to work after boot.
2) If you uncheck “Sharing this folder”, then you must click on unmount symbol
on nautilus tree to uncouple sharing.