DEV Community

Cover image for CentOS Stream 9 : Install Samba to Configure File Server.
Muhammad Shahidul Islam
Muhammad Shahidul Islam

Posted on

CentOS Stream 9 : Install Samba to Configure File Server.

For example, Create a fully accessed shared Folder which anybody can read and write, and also authentication is not required.
[1] Install and Configure Samba.

[root@smb ~]# dnf -y install samba
[root@smb ~]# mkdir /home/share
[root@smb ~]# chmod 777 /home/share
[root@smb ~]# vi /etc/samba/smb.conf
[global]
        # line 11 : add (set charset)
        unix charset = UTF-8
        workgroup = SAMBA
        security = user
        # add IP addresses you allow to access
        hosts allow = 127. 10.0.0. 
        # add (no authentication)
        map to guest = Bad User

.....
.....

# add to the end
# any Share name you like
[Share]
        # specify shared directory
        path = /home/share
        # allow writing
        writable = yes
        # allow guest user (nobody)
        guest ok = yes
        # looks all as guest user
        guest only = yes
        # set permission [777] when file created
        force create mode = 777
        # set permission [777] when folder created
        force directory mode = 777 

[root@smb ~]# systemctl enable --now smb

Enter fullscreen mode Exit fullscreen mode

[2] If SELinux is enabled and also use [/home] like this example, Change SELinux policy.


[root@smb ~]# setsebool -P samba_enable_home_dirs on
[root@smb ~]# restorecon -R /home/share
Enter fullscreen mode Exit fullscreen mode

[3] If Firewalld is running, allow Samba service.

[root@smb ~]# firewall-cmd --add-service=samba
success
[root@smb ~]# firewall-cmd --runtime-to-permanent
success
Enter fullscreen mode Exit fullscreen mode

Top comments (0)