CentOS 7 SAMBA Standalone Server

This guide will detail how to build a standalone SAMBA server on CentOS 7. I used a HP MicroServer Gen8 with an Adaptec 6405E RAID card and 4x Western Digital Red 2TB drives in RAID 10. This guide will also work with RHEL 7.

Because I’m becoming lazy in my old age I’ll presume you’ve already installed CentOS 7 (I used the minimal ISO) and have it configured with networking and you’re syncing time with your local NTP server (mine is ‘au.pool.ntp.org‘) and have also run an initial ‘yum update -y‘ to make sure you’ve got all the latest basic system updates.

  1. Install SAMBA
    yum install -y samba
  2. Disable SELinux (Not recommended in corporate production but I’m keeping things simple)
    setenforce 0
    sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/sysconfig/selinux
  3. Rename the default SAMBA config
    mv /etc/samba/smb.conf /etc/samba/smb.conf.orig
  4. Use the following config file. You might need to customise it based on your requirements, which I’ve highlighted in bold, but you can use the defaults for testing.
    vi /etc/samba/smb.conf
    [global]
        workgroup = WORKGROUP
        server string = Samba Server Version %v
        security = user
        passdb backend = tdbsam
    
        local master = yes
        preferred master = yes
        socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072
        use sendfile = true
    
        log file = /var/log/samba/log.%m
    
    #============================ Share Definitions ==============================
    
    [samba]
        comment = SAMBA Data
        path = /data/samba
        writeable = yes
        force user = samba
        force group = samba
        force directory mode = 0770
        force create mode = 0660
        directory mode 0770
        create mode 0660
    
  5. Add a user to own your data
    groupadd samba
    useradd -g samba samba
    smbpasswd -a samba
    # Specify your password when prompted.
  6. Create the filesystem location where the SAMBA data will be stored
    mkdir /data/samba
    chown samba.samba /data/samba
    chmod 0770 /data/samba
  7. Allow the SAMBA services through the firewall
    firewall-cmd --permanent --add-service=samba
    firewall-cmd --reload
  8. Start the SAMBA services
    systemctl enable smb
    systemctl enable nmb
    systemctl start smb
    systemctl start nmb
  9. You should now be able to connect to your SAMBA server using its IP or hostname.

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*
Website