Samba Server in Linux
Introduction
Samba is the free software re-implementation of the common internet file system (CIFS) also known as the SMB protocol,Microsoft clients will use this protocol to access files located on your linux/unix Server just as if it were a native windows server,Samba allows file and print sharing between computers running microsoft windows and computers running unix,samba uses the smb network protocol(server message block) which is used by windwos systems to communicate with each other to share files on the same network using Samba linux systems map drive to windows systems ,windows systems map drive to linux systems,samba is an useful networking tool for anyone who has both windows and unix systems on his network running on a unix system ,it allows windows to share files and printers onthe unix host,and it allows unix users to acess resources shared by windows systems
Configuring Samba Sever
let us Start the Process
Step1: Install samba package (Update pacakage lists and install samba package using following commands)
sudo apt update -y
sudo apt install samba -y
sudo yum update -y
sudo yum install samba* -y
Step2:One installed ,make directory and assign full permissions
mkdir /samba_share
chmod 777 /samba_share
Step 3: Check the context of the directory and change it to according to samba
ls -ldZ /samba_share
drwxrwxrwx. root root unconfined_u:object_r:default_t:s0 /samba_share/
chcon -t samba_share_t /samba_share/
ls -ldZ /samba_share/
drwxrwxrwx. root root unconfined_u:object_r:samba_share_t:s0 /samba_share/
Step 4: Create auser or use existing use who will be allowed to login in as samba use
smbpasswd -a smbuser
new SMB password:
retype new SMB password:
added user smbuser.
todelete a use from samba,use smbpasswd -x username
To check all the samba users
pdbedit -L
Step 5:Open configuration file and add/modify the following lines
vi /etc/samba/smb.conf
[fileshare]
comment = Public Stuff
path = /samba_share
public = no
valid users = smbuser
writable = yes
printable = no
host allow = 192.168.1.0/24
host allow -network range or host range
Step 6: Test the samba parameters
testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimumwindows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Processing section "[smbshare]"
loaded services file OK.
Server role:ROLE_STANDALONE
press enter to see adump of your service definitions
[printers]
comment = All printers
path =/var/spool/samba
printable = Yes
print ok =Yes
browseable = No
[fileshare]
comment = Public Stuff
path = /samba_share
valid users = smbuser
read only = No
hosts allow = 192.168.1.0/24
Step -7 : Restart the samba and nmb services
sudo services smb restart
sudo chkconfig smb on
sudo service nmb restart
sudo chkconfig nmb on
sudo systemctl restart smb
sudo systemctl enable smb
sudo sytemctl restart nmb
sudo systemctl enable nmb
Windows as client: To connect samba server ,right click onmy computer and select map network drive
Give the address of the samba server and click on finish button to continue
When properly configured,it wil prompt for username and password and you can see the files and you can add the files to samba server
THANKS FOR VIEWING MY BLOG FOR MORE UPDATES FOLLOW ME