Samba Server Configuration in RedHat Linux

 

Samba Server Configuration in RedHat Linux



At Server Site(IP Address: 10.1.1.3/24):


yum  -y  install  samba*



mkdir      /share

chmod  -R  777  /share

chcon  -R  -t  samba_share_t  /share/

semanage   fcontext   -a   -t   samba_share_t   /share/

setsebool   -P   samba_enable_home_dirs   on

useradd  smbuser1

usermod   -G   hr-dept   smbuser1

smbpasswd  -a  smbuser1




cd /etc/samba/

cp -p smb.conf smb.conf.orig         ;[We are taking backup of  main configuration file for safety]


vim   /etc/samba/smb.conf

   # To allow network to reach samba server:

workgroup = MYGROUP

interfaces = eth0  10.1.1.0/24

hosts allow = 127.    10.1.1.


    # To share the folder and others facts:

[share_name]

     path = /share

public = no

     comment = samba share for hr-dept

    writable = yes

valid users = smbuser1,@hr-dept

    browseable = yes

   :wq

 




testparm       ;[testparm command will check smb.conf file for internal errors. After giving this command hit enter]

smbstatus     ;[To see the status of samba share]


systemctl start smb.service

systemctl start nmb.service

systemctl enable smb.service

systemctl enable nmb.service


firewall-cmd   --permanent  --add-service=samba

firewall-cmd --reload




At Client Site:


Linux Client:


yum install -y samba*


systemctl start smb.service

systemctl start nmb.service

systemctl enable smb.service

systemctl enable nmb.service



firewall-cmd   --permanent  --add-service=samba

firewall-cmd --reload


To see shared folder for smbuser1 from client mahcine:

smbclient   -L   \10.1.1.3  -U   smbuser1          ;[Here - 10.1.1.3 is the IP of Server Machine; -L = For listing shared objects.] 


To access shared folder have to need mount:

mkdir  /myshare

mount   -t   cifs   //10.1.1.3/share  -o    username=smbuser1  /myshare

Now, Enter into mount point to access server's share folder and create a file.

After creating a file you will see this file at your server's folder as well. Go to server machine's /share folder. You will get a file name mushfiq.txt which you have crested at client site.



Windows Client:


Step-01:  Have to check ping connectivity first with server' ip. Here 10.1.1.3  is my Server's IP


Step-02:  Have to change default workgroup to 'MYGROUP'. After changing it, need to restart.
        for this >> open Command Prompt and write sysdm.cpl




Step-03:  Now we will try to access share folder as usual.



Note: If you unable to access share folder, you have to off selinux of your Server   by 
"setenforce 0"  command 







To delete the session with server's share folder in cmd: 
Net  Use  *  /delete                            [To delete all shared connections with others]
Net Use  \\10.1.8.209\IPC$  /delete          [To delete all shared connections with specific IP]








Comments

Popular posts from this blog

Some Questions for MTCNA Exam

ডিপ্লোমা লেভেল এর ইন্ডাস্ট্রিয়াল এটাচমেন্ট এ আসার পূর্বে একটু ভেবে আসার অনুরোধ রইলো

Basic Router & Switch IOS commands