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...

Linux Prepatching tasks

 Pre-patching tasks in a Linux environment are critical to ensuring a smooth and successful patching process. These tasks help in minimizing downtime, preventing issues during the patching, and ensuring the system's stability. Here’s a checklist of common pre-patching tasks you should perform: 1. Backup Critical Data Full System Backup : Perform a full system backup, including configuration files, databases, and critical application data. Verify Backup Integrity : Ensure that the backup is complete and can be restored if necessary. 2. Review Patch Notes Understand the Patch : Review the release notes and documentation for the patches you plan to apply. Understand what is being updated and any potential impact on your system. Check Dependencies : Verify that all dependencies for the patches are met, including hardware, software, and configuration requirements. 3. Check System Health Disk Space : Ensure there is sufficient disk space available, especially on /var , /tmp , and /boot ...