Today I’ll show you how to share folders in Ubuntu for home networks, so that you can go to your folders in linux, for example from a Windows computer.
So, let’s start.
Install samba:
sudo apt-get update
sudo apt-get install samba
After the samba is installed, you need to fix the config. For this we type:
sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
sudo nano /etc/samba/smb.conf
Insert the following lines to the file:
[global]
workgroup = WORKGROUP
server string = servername
netbios name = SERVERNAME
#servername should be <span class="short_text" id="result_box" lang="en"><span>replaced with your host name</span></span>
log file = /var/log/samba/%m.log
max log size = 50
security = user
#<span class="short_text" id="result_box" lang="en"><span>prohibit guest access</span></span>
map to guest = Bad User
dns proxy = no
#enable symlinks following
unix extensions = no
wide links = yes
follow symlinks = yes
# utf encoding
dos charset = cp866
unix charset = UTF8
# disable printers
load printers = no
show add printer wizard = no
printcap name = /dev/null
disable spoolss = yes
# <span class="short_text" id="result_box" lang="en"><span>You can restrict access to addresses / networks</span></span>
# hosts allow = 127. 192.168.24.
# <span id="result_box" lang="en"><span>By default, all files starting with a dot will have the attribute "hidden"</span></span>
hide dot files = yes
#adding a share
#shared <span class="short_text" id="result_box" lang="en"><span>folder name</span></span>
[system_trash]
#path to it
path = /mnt/system_trash
guest ok = no
read only = no
browsable = yes
writeable = yes
Next, you need to see what would be the name of your host corresponded to the ip address of this host:
sudo nano /etc/hosts
There should be a line like:
192.168.1.100 servername
After that, save the file (in the nano – key combination ctrl + x) and restart the samba:
sudo /etc/init.d smbd restart
sudo /etc/init.d samba restart
Next, you need to add the user to samba users (the user should exists on the system). Add a new user to the system and samba:
sudo adduser user
sudo smbpasswd -a user
After the user is added you can try to go to our share from the Windows machine. We enter the user’s login and password. Our share will have to open.
For your reference – to see samba users you need to type the following command:
sudo pdbedit -L -v
To remove Samba user:
sudo smbpasswd -x user
Video on the topic: