Centos – what does “chcon -t samba_share_t /path/to/share” do

centossamba

I am setting up a samba share and two shares that are identical one is accessible and one is not. Wile looking into what might solve the problem I saw this command. I can not find what it does though.

What does "chcon -t samba_share_t /path/to/share" do?

To elaborate on this question why would I ever need to run this command on one share but not the other. Both shares were created the same, same user and same computer.

Best Answer

It changes the SELinux context of the specified path to samba_share_t. This would be necessary if you have SELinux in enforcing mode on your system and the path being referred to was not previously designated as a Samba share (via SELinux labeling).

Related Question