how to configure samba | step by step samba configuration in Ubuntu 16.4

how to configure samba | step by step samba configuration in Ubuntu 16.4

Q1 - Step by Step Samba server Configuration ?
Q2 - how to configure samba public and secure ?
Q3 - access samba server in windows ?
Q4 - Access Samba in Linux ?
Q5 - Public and Protected Samba sharing ?

Configure samba server in Ubuntu 16.04 with anonymous & secured

Samba is an Free and Open Source Software that provides seamless file and print services to SMB/CIFS clients. samba allows for interoperability between Linux/Unix servers and Windows-based clients.

A Samba file server enables file sharing across different operating systems over a network. It lets you access your desktop files from a laptop and share files with Windows and mac OS users.

Step 1

Update repositories
apt-get update
Installation required package of samba.
apt-get install samba samba-common python-glade2 system-config-samba

Configure Samba :

This file has two parts: a [global] section and a [shares] section.
in [global] section we define rules for all shared folders and second section [shares]  we define share directory name

Edit configuration file  :
   cp /etc/samba/smb.conf /etc/samba/smb.conf.backup    vi /etc/samba/smb.conf
workgroup = WORKGROUP           # Workgroup name

server string = linuxtopic       # This is the identifying information that will be supplied to users during connections.

server role = standalone server       # Defines mode of Samba like "standalone server", "member server", "classic primary, domain controller, "classic backup domain controller", "active directory domain controller".

#security = user

Video Tutorial Hindi :

Video Tutorial English

Configure Samba Public Share

  path = /samba/public
  writable = yes
  guest ok = yes
  guest only = yes
  read only = no
  create mode = 0777
  directory mode = 0777
  force user = nobody

Create directory for public share
mkdir -p /samba/publicsudo chown -R nobody:nogroup /samba/publicsudo chmod -R 0775 /samba/public

Verify  samba configuration

Restart samba service :
service smbd restart
Allow  samba ports in firewall
iptables -A INPUT -p tcp --dport 139 -j ACCEPTiptables -A INPUT -p tcp --dport 445 -j ACCEPTiptables -A INPUT -p udp --dport 137 -j ACCEPTiptables -A INPUT -p udp --dport 138 -j ACCEPT

Access Samba share on  Windows

Go to run and type


Access samba sharing in  Ubuntu

Install Required package on Ubuntu
sudo apt-get updatesudo apt-get install smbclient
Access samba using the command
smbclient -N //

Configure Samba Private Share
vi /etc/samba/smb.conf
path = /samba/protected
valid users = @smbgroup
guest ok = no
writable = yes
browsable = yes

To create a group
addgroup smbgroupadd a user in to the group
Add users
useradd lokeshuseradd linuxtopic
Add users in samba group
usermod -aG smbgroup lokeshusermod -aG smbgroup linuxtopic

Samba keeps its own database of users and passwords so we add user to the Samba server , which it uses to authenticate logins
smbpasswd -a lokeshsmbpasswd -a linuxtopic

The user will be prompted to enter and confirm a password. This password will be used to access the protected samba shares.

Create directory for protected share
mkdir -p /samba/protected
Give members group access to this share.
chown -R root:smbgroup /samba/protectedchmod -R 0770 /samba/protected

Restart Samba Service
systemctl restart smbd
Access samba using the command
smbclient  //
smb: \> mkdir  test1
smb: \> mkdir  test2

smb: \>  ?

Thanks ,
Please Share, like and comment on this, it's valuable to us

Next Post »