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

Linux basic commands

 Linux basic commands: du  -sh  *  |  sort  -h  -r   |  head  -n  40  :    list out first 40 files in the directory that are taking more space in the directory.  cd : change directory Is-l listing the items in long listing format  pwd : print working directory Is-I format: type :no of links:owner : group:size :month :day :time :name cd/: go to/directory whoami: tells us by which username we are logged in. touch jerry: creates the file named jerry in present working directory. cp jerry lex: copy the content of jerry file and paste it to lex file. vi text1: creates the file text1 and open it in vi editor mkdir superman: creates the directory called superman mkdir abc def  : creates 2 folder in one command. touch filename wont work in /etc/ folder if logged in by normal account. man cp: shows manual for cp command. echo "india is my country"> file1 puts the text in file1. rm filename: remove the filename  mv lex luther renames the file from lex to luther  mv luther /h

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 expected do