Setting up Samba Server for Managed Storage

  1. To install Samba in RHEL, run:

    yum update -y 
    yum install samba -y
  2. Then, enable and check Samba status:

    systemctl enable --now smb 
    systemctl status smb
  3. Now that Samba is installed, create a directory for it to share.
    The command below creates a new folder /data/filecloud and sets proper Samba permissions by  an authenticated user who should have full permissions to the share.

    mkdir -p /data/filecloud 
    adduser --home /data/filecloud --no-create-home --shell /usr/sbin/nologin --group sambashare filecloud 
    chmod 2770 /data/filecloud 
    chown filecloud:sambashare /data/filecloud
  4. Samba keeps its own database of users and passwords, which it uses to authenticate logins. In order to log in, all users must be added to the Samba server and enabled.
    Execute the following smbpasswd commands to accomplish both of these tasks:

    smbpasswd -a filecloud 
    smbpasswd -e filecloud
  5. The configuration file for Samba is located at /etc/samba/smb.conf. To add the new directory as a share, edit the file by running:

    vi /etc/samba/smb.conf

    Below is the samba conf sample used in this setup:

    [global]
     server string = samba_server
     server role = standalone server
     interfaces = 192.168.1.120
     bind interfaces only = yes
     disable netbios = yes
     smb ports = 445
     log file = /var/log/samba/smb.log
     max log size = 10000
    
    [filecloud]
     path = /data/filecloud
     browseable = yes
     read only = no
     force create mode = 0660
     force directory mode = 2770
     valid users = filecloud

    To mount the Samba share in your FileCloud web server nodes, see How to properly mount a CIFS share on Linux for FileCloud.