Install Samba on Centos 7

Samba is the standard Windows interoperability suite of programs for Linux and Unix.

Since 1992, Samba has provided secure, stable and fast file and print services for all clients using the SMB/CIFS protocol, such as all versions of DOS and Windows, OS/2, Linux and many others.

Samba is an important component to seamlessly integrate Linux/Unix Servers and Desktops into Active Directory environments. It can function both as a domain controller or as a regular domain member.

Samba is a software package that gives network administrators flexibility and freedom in terms of setup, configuration, and choice of systems and equipment. Because of all that it offers, Samba has grown in popularity, and continues to do so, every year since its release in 1992.

# yum install samba samba-client samba-common

Configure samba

# cp -pf /etc/samba/smb.conf /etc/samba/smb.conf.bak

# vim /etc/samba/smb.conf

delete all & insert:

[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = centos
security = user
map to guest = bad user
dns proxy = no
#============================ Share Definitions ==============================
[Anonymous]
path = /samba/anonymous
browsable =yes
writable = yes
guest ok = yes
read only = no

save & exit

A> Configure a anonymous samba share folder.

# mkdir -p /samba/anonymous
# cd /samba
# chmod -R 0755 anonymous/
# chown -R nobody:nobody anonymous/
# ls -l anonymous/
# systemctl restart smb.service
# systemctl restart nmb.service

browse your server ip address from your pc, go to anonymous folder & try to create a file.

B> Secured samba server.

# groupadd smbgrp
# useradd cannon -G smbgrp
# smbpasswd -a cannon
# mkdir -p /samba/secured
# cd /samba
# chmod -R 0777 secured/
# chown -R cannon:smbgrp secured/
# vim /etc/samba/smb.conf

insert at the bottom of the file.

[secured]
path = /samba/secured
valid users = @smbgrp
guest ok = no
writable = yes
browsable = yes

# systemctl restart smb.service
# systemctl restart nmb.service

testparm

[root@localhost samba]# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section “[Anonymous]”
Processing section “[secured]”
Loaded services file OK.
Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

# Global parameters
[global]
netbios name = CENTOS
server string = Samba Server %v
map to guest = Bad User
security = USER
dns proxy = No
idmap config * : backend = tdb

[Anonymous]
path = /samba/anonymous
guest ok = Yes
read only = No

[secured]
path = /samba/secured
read only = No
valid users = @smbgrp

Log on to samba on your pc and try to login the secured folder and create a file.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *