Solution to Samba inaccessibility caused by CentOS turning on SELinux

SELinux is enabled by default when installing CentOS, so samba, FTP and other applications cannot access the corresponding directories. The solution is as follows:

Enable Samba user home directory permission

/usr/sbin/setsebool -P samba_enable_home_dirs=1

Turn on single shared directory (path) permission

chcon -t samba_share_t path

Open all shared directories

Read-only rights

/usr/sbin/setsebool -P samba_export_all_ro on

read-write permission

/usr/sbin/setsebool -P samba_export_all_rw on

Check whether a directory (path) has permission enabled

ls -ldZ path

Similar Posts: