File Server – How to Set up Samba (unsecure) in CentOS/ Red Hat Linux 7

Samba is software that can be run on a platform other than Microsoft Windows, for example, UNIX, Linux, IBM System 390, OpenVMS, and other operating systems. Samba uses the TCP/IP protocol that is installed on the host server. When correctly configured, it allows that host to interact with a Microsoft Windows client or server as if it is a Windows file and print server.

Samba Server:

OS: CentOS 7

Hostname: centos

IP Address: 192.168.1.107/24

Samba Client:

OS: Windows 10

IP Address: 192.168.1.109

  • Check for existing samba package, if any using below commands:

rpm -qa | grep samba

yum list installed | grep samba

  • Remove Samba, if any using below commands

yum remove samba*

  • Install Samba

yum install samba samba-client samba-common

  • Edit samba configuration file using your favorite text editor

vim /etc/samba/smb.conf

  • Add following lines, and make changes as shown below

[global]
workgroup = Workgroup
server string = Samba Server %v
netbios name = centos
security = user
map to guest = no

Add share definitions to the end of file

[Anonymous]
path = /samba/anonymous
browsable = yes
writable = yes
guest ok = yes
read only = no

  • Make folder for samba share

mkdir -p /samba/anonymous

  • Enable and restart services

systemctl enable smb.service
systemctl enable nmb.service
systemctl restart smb.service
systemctl restart nmb.service

  • Add IPtables rules to firewall, so that samba will work as expected.

firewall-cmd --permanent-zone=public --add-service=samba
firewall-cmd --reload

  • Change permission for samba share

chmod -R 0755 /samba/anonymous
chown -R nobody:nobody /samba/anonymous

  • Allow selinux for samba configuration

chcon -t samba_share_t /samba/anonymous

  • To access Samba share on linux machine through windows machine, go to Run and type\\centos or \\191.168.1.107
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: