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

Popular posts from this blog

patching tasks

 Patching a Linux system is a critical task to ensure that the system remains secure, stable, and up-to-date with the latest features and fixes. Here’s a comprehensive guide to the tasks involved in Linux patching: 1. Pre-Patching Preparation Backup System : Ensure you have a full system backup, including critical data, configuration files, and applications. Test the backup to verify its integrity. Check Disk Space : Verify that you have enough disk space, particularly on /var , /tmp , and /boot partitions. Review Current Patch Level : Determine the current patch level and installed packages using package management tools like yum , apt , dpkg , or rpm . Check System Logs : Review system logs to identify any issues that might affect the patching process. Test in a Staging Environment : If possible, apply patches in a staging environment that mirrors production to identify potential issues. Notify Stakeholders : Inform stakeholders about the scheduled maintenance window and expecte...

Post build configurations on Redhat VM

  ************************************* Post build configuration on Linux VM: ************************************* Set the hostname. hostnamectl set-hostname <Servername> ***************************************** Network configuration : Make sure VM gets the ipv4 ip address either from DHCP or assign the static ip address to it.   Question : How to assign the static ip address to the linux machine using the nmcli ?  Answer: fire the below commands: nmcli device nmcli connection modify enpos3 ipv4.addresses 10.253.1.34/24 nmcli connection modify enpos3 ipv4.gateway 10.253.1.1 nmcli connection modify enpos3 ipv4.method manual nmcli connection modify enpos3 ipv4.dns 8.8.8.8 nmli connection down enpos3 nmcli connection up enpos3 ip address show enpos3 nmcli connection show ************************†****************** Register to RHΝ. Register to redhat network if the linux vm is redhat vm. subscription-manager register --org <org>  --activationkey <activat...