You are here

How to make a shared folder in linux, setting samba


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 replaced with your host name
log file = /var/log/samba/%m.log
max log size = 50 
security = user 
#prohibit guest access
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
# You can restrict access to addresses / networks
# hosts allow = 127. 192.168.24.

# By default, all files starting with a dot will have the attribute "hidden"
hide dot files = yes

#adding a share
#shared folder name
[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:

0 0

Share the article with your friends in social networks, maybe it will be useful to them.


If the article helped you, you can >>thank the author<<