Friday, June 28, 2013

SAMBA-SEVER

                                SAMBA-SERVER
                   ======================================


samba - server massage block

port no. - 137,138,139,445

package  - samba

Daemon   - smb
--------------------------

* Insatall the package first

#yum install samba* -y

* Configure the "/etc/samba/smb.conf"

#vim   /etc/samba/smb.conf


* Go to the end of the line and copy the  last 7 line and past below of that

        [linux]
;       comment = RHCE
;       path = /samba
;       pliublic = yes
;       writable = yes
;       printable = no
;       write list = +staff
    browsable  = yes
    valid user = tom

    :wq   save this file and quit


#service  smb restart


* Make  a directory on  '/' for shayring the 'SAMBA'


#mkdir  /samba


* Give the full permission of this dir

  #chmod  777  /samba

  #cd  /samba
   
  #touch  file1, file2, file3   (creat some file in /samba dir. )


* Add the user for SAMBA server

  #adduser  tom

  #passwd   tom

  XXXX


  #smbpasswd  -L  -a  tom

  XXXX



* Add the all port no. in the  Iptables


  #iptabes  -I  INPUT  -s  192.168.0.0/24  -p   tcp   -m   multiport   --dport  137,138,139,445  -j   ACCEPT


            (SAME WITH 'UDP' PROTOCOL )

  #service  iptables  save

  #service  iptables  restart


  #iptables  -L  ( to show the all configuration of iptabels )



* Change the SELinux  security context

  #chcon  -t  samba_share_t  /samba

  #getsebool  -a |grep  samba


  #setsebool  -P samba_enable_home_dirs    on

  #setsebool  -P use_samba_home_dirs       on


  #service   smb   restart



  #chkconfig   smb    on


   FROM  CLIENT  END 
 =======================

 #smbclient  //192.168.0.1/linux  -U   tom         [ where 'linux' is public script name  and 'tom' is user]

 password  =  xxxx

 #ls


              OR


  #smbclient  192.168.0.1/linux  -U  tom%123      [where 'tom' is user and '123' is the password of user]
---------------------------------------------------------------------------------------------------------------
                                         
    (if we want to change the  user's password than run these command)

    #smbpasswd   tom             [ change the password ]

    #smbpasswd   -d   tom        [ disable the password ]

    #smbpasswd   -e   tom        [ enabale the password ]      

    #smbpasswd   -x   tom        [ to delet the users from SAMBA  server ]
       
---------------------------------------------------------------------------------------------------------------
        (if  want to check the  syntex of smb.conf than)

    #testparm   /etc/samba/smb.con   ( it will show if is there is any kind of error in configurtion file) -

   
    (we can check also from network side )

    #testparm   /etc/samba/smb.conf  server1.deo.com   domain  192.168.0.1   [enter]


   
    FROM LINUX CLIENT END
      ==============================

    #mount -t cifs //192.168.0.1/samba  /mnt -o user = username
   
     *Permanent mount through /etc/fstab

    #vi /etc/fstab
   
    //192.168.0.1/samba    mnt     cifs    username = tom    0 0

    :wq  save the file



    #mount -a

    1.share directory of samba

    2.user name
       
    3.password of user

==========================================

No comments:

Post a Comment