Sharing files and folders with Samba – Definitive Guide


by Flavio Antonini - 2016 - last update: june 11 2016 ~ last edited by joekamprad (january 2018)

# tutorial fitting GNOME setup only #

Install samba and needed apps:
`sudo pacman -Ss samba nautilus-share gnome-user-share`

stop the following services...
`sudo systemctl stop samba smbd nmbd`

verify if smb.conf file exist...
`ls /etc/samba`

if not then copy the file examples/smb.conf from to smb.conf (this fix also sharing printer troubleshooting)...

Just take this content.;a=blob_plain;f=examples/smb.conf.default;hb=HEAD

and place the file in /etc/samba/smb.conf

select to 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>

then add you user to sambashare group:
sudo gpasswd -a <your-user> sambashare

edit smb.conf...
sudo gedit /etc/samba/smb.conf

uncomment following line in etc/samba/smb.conf file under [global] settings section...
include = /etc/samba/smb.conf.%m

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

verifying if the following services is setting to enable...
systemctl is-enabled samba
systemctl is-enabled smbd
systemctl is-enabled nmbd

if not then settings it to enabled (give only the necessary command)...
sudo systemctl enable samba
sudo systemctl enable smbd
sudo systemctl enable nmbd

If you use a firewall (that is recommended) then you must set a couple of ports to allow the Netbios service (nmbd)
to view your PC. Then:

check if you hare gufw installed...
pacman -Ss gufw

if not then install it...
sudo pacman -S gufw

verify that ufw service is enabled...
systemctl is-enabled ufw

if not then enable it...
sudo systemctl enable ufw

then you must enable on 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: (except for installation instructions that concern to ubuntu).

Now reboot Linux...

then, when your system is ready, try to open nautilus (File)
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

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.

(Visitado 10,305 vezes, 1 visitas hoje)

Pinar no Pinterest

Partilhar Isto