Install Samba and Configure

samba server

What is Samba?

Samba - techouse.co.in

Samba is open-source software that runs on Unix/Linux based platforms but is able to communicate with other Operating systems like Windows clients a native application. Samba is based on the common client/server protocol of Server Message Block (SMB) and Common Internet File System (CIFS). So Samba is able to provide this service by providing the Common Internet File System (CIFS).



How to setup the samba server

How to Install Samba in Centos

[[email protected] samba_user]# yum install -y samba samba-commons cups-libs policycoreutils-python samba-client

Add Group for Samba

[[email protected] samba_user]# groupadd samba_group

Add User for Samba

[[email protected] samba_user]# useradd samba_user
[[email protected] samba_user]# usermod -G samba_group samba_user
[[email protected] samba_user]# smbpasswd -a samba_user

Change the SELinux security context

[[email protected] samba_user]# chcon -R -t samba_share_t /samba_user/
[[email protected] samba_user]# semanage fcontext -a -t samba_share_t /samba_user/
[[email protected] samba_user]# setsebool -P samba_enable_home_dirs on

Configure Firewall

[[email protected] samba_user]# firewall-cmd --permanent --add-rich-rule=‘rule family=“ipv4” source address=“192.168.56.0/24” service name=“samba” log prefix=“samba” level=“info” limit value=“1/m” accept’

[[email protected] samba_user]# firewall-cmd --reload




Edit Samba configuration file to add specific Directory into Samba

Edit /etc/samba/smb.conf file

[[email protected] samba_user]# cd /etc/samba/

Before Editing Samba configuration File take a backup

[[email protected] samba_user]# cp -p smb.conf smb.conf.orig
[[email protected] samba_user]# vi /etc/samba/smb.conf

[shared_samba]
comment = shared-directory
path = /home/samba_user
public = no
valid users = samba_user, @samba_group
writable = yes
browseable = yes
create mask = 0765

Now start and Enable the Samba Server

[[email protected] samba_user]# systemctl start smb.service

[[email protected] samba_user]# systemctl enable smb.service

Use below command to connect Samba in Ubuntu

smb://192.168.1.16






For Windows

\\192.168.1.16

Terminal command to connect to Samba Server

smbclient -L \192.168.56.102 -U test




Allow the network to connect with Samba Server

[[email protected] samba_user]# vim /etc/samba/smb.conf

interfaces = lo enp0s8 192.168.56.00/24
hosts allow = 127. 192.168.56.

workgroup = MYGROUP

[[email protected] samba_user]# vi /etc/services

netbios-ns 137/tcp # netbios name service
netbios-ns 137/udp # netbios name service
netbios-dgm 138/tcp # netbios datagram service
netbios-dgm 138/udp # netbios datagram service
netbios-ssn 139/tcp # netbios session service
netbios-ssn 139/udp # netbios session service

[[email protected] samba_user]# systemctl start smb.service
[[email protected] samba_user]# systemctl start nmb.service

[[email protected] samba_user]# systemctl enable smb.service
[[email protected] samba_user]# systemctl enable nmb.service



techouse

I love helping beautiful people like you. I love hanging out with my dogs.

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.