samba set up file sharing server (centOS 7)

1. Install and start Samba

  yum -y install samba

  systemctl start smb.service

  // set the boot

  systemctl enable smb.service

 

2. Close safety

  // close selinux:

  vi /etc/sysconfig/selinux

    SELINUX=enforcing 改为 SELINUX=disabled

  // turn off the firewall

  systemctl disable firewalld.service

  // restart to take effect

  shutdown -r now

 

3. Configure File Sharing

  // Create a shared directory

  mkdir /home/share

  // Create user groups and users  

  groupadd samba

  useradd -g shamba share

  passwd share  // password:share

  // add samba File Sharing

  smbpasswd -a share  //password:share

  // modify the samba configuration

  we /etc/samba/smb.conf

    [global]

      workgroup = samba
      security = user
      map to guest = Bad User
      log file = /var/log/samba/log.%m

    [share]
      comment = share
      valid users = @samba
      read only = yes
      path = /home/share
      hosts allow = 192.168.

  // restart the samba service

  testparm

  systemctl restart smb.service

 

4. Mount the client files

  mkdir /home/share

  mount -t cifs //(ip)/share /home/share -o "username=share,password=share"

Guess you like

Origin www.cnblogs.com/-StarrySky-/p/11892434.html