1

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.

4

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).

2

John's answer gives an excellent explanation of the second part of your question. To add to John's answer, the command broken down looks like this:

  • chcon - Changes security context for files. You can read more about chcon here.
  • -t samba_share_t - The -t is used to designate the target security context's type, which in this case, is samba_share_t.
  • /path/to/share/ is the file targeted for the chcon operation.
  • I ran this on one of my shares and it granted access to the share folder but not sub folders is there a way to apply it to all sub folders? – Starblight Jan 31 '18 at 20:35
  • 1
    You can use the -R or --recursive parameter to operate on all files and sub-folders. – aliceinpalth Jan 31 '18 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.