Skip to main content

Samba configuration on linux server

 


Samba configuration on Linux Server: (without password samba sare)


• Samba is the Linux tool or utility that allows sharing of the Linux resources such as files and printers with other operating system.


• It works exactly like NFS but the difference is NFS shares within linux or Unix like system whereas Samba shares with other OS. (Windows,MAC).


For Example: computer A shares its filesystem with computer B using samba then computer B will see the shared filesystem as if it is mounted as the local filesystem.


• samba shares its filesystem through a protocol called SMB. (server message Block) which was invented by IBM.


• Another protocol used to share the samba is through CIFS(common Internet File system) invented by Microsoft and NMB.


• Steps of the samba configuration:


> Take the snapshot of VM.


Alway take the snapshot before any configuration, because if anything goes wrong we can revert to the snapshot.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


> Install samba packages.

#yum install samba samba-client samba-common

also after the packages installation, run the following command to make sure the packages are installed.

#rpm -qa | grep samba



>>>>>>>>>>>>>>>>>>>>>>>>>>>>


>Enable samba to be allowed through firewall.

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

#firewall-cmd   -reload


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

> or Disable firewall

#systemctl stop firewalld

#systemctl disable firewalld


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

> create the samba share directory and assign permissions.

#mkdir -p  /samba/morepretzels

#chmod  a+rwx  /samba/morepretzels

#chown  -R  nobody:nobody  /samba

#chown  -R  nobody:nobody   /samba/morepretzels/


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

>Also change the SElinux security context for the samba shared directory.

#sestatus: shows the status of selinux

#chcon  -t  samba_share_t  /samba.morepretzels



>>>>>>>>>>>>>>>≥>>>>>>>>>>>>>>>>



> or disable SElinux.

#sestatus

#vi /etc/selinux/config


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


change

SELINUX=enforcing 

to

SELINUX=disabled


#reboot

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

> modify /etc/samba/smb.conf file to add new shared filesystem.


#cp-p/etc/samba/smb.conf /etc/samba/smb.conf_bkp


#vi  /etc/samba/smb.conf



Write the below content in smb.conf file:


[global]

workgroup =WORKGROUP

netbios name = centos

security = user

map to guest = bad user

dns proxy = no



[Anonymous]

path = /samba/morepretzels

browsable = yes

writable = yes

guest ok = yes

guest only = yes

read only = no


>>>>>>>>>>>>>>>>>>>>>>>>>>>>


>verify the settings.

#testparm



> once the packages are installed, enable and start Samba services.

#systemctl enable smb

#systemctl enable nmb

#systemctl start smb

#systemctl start nmb

#systemctl status smb

#systemctl status nmb


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


> Mount samba share on the windows client

Go to start

Go to search bar

type  \\ip of linux machine where samba is configured


>>>>>>≥>>>>>>>>>>>>>>>>>>>>>>>>>>>>

>mount samba share on linux client.

#yum -y install cifs-utils samba-client


create the mount point directory

#mkdir  /mnt/sambashare


mount the samba share

#mount  -t  cifs  //192.168.1.18/Anonymous /mnt/sambashare


Comments