I'm using CentOS 7!

I want to know if is possible share root / Linux directory.

In root mode:

# kwrite /etc/samba/smb.conf

Here the line contents

  workgroup = MyGroup
  server string = Description
  netbios name = MyServer

  path = /
  valid users = root
  browsable =yes
  writable = yes
  guest ok = yes
  read only = No


Now apply changes!

# chcon -R -t samba_share_t /

Is smart Before sentence applying to "/"? Because, I had problem with the before command, and now, I can't logging with root user or another user.

# service nmb restart
# service smb restart
# service winbind restart
  • If you ran that chcon command, you have broken the security context of your system which has very specific contexts by default throughout your filesystem. Try booting in rescue mode, mount your disk, change SELINUX to disabled in /etc/sysconfig/selinux. Then unmount your disk and restart normally.
    – MikeA
    Oct 10, 2016 at 20:14
  • Thank you!, Then is impossible to share "/" directory? Oct 11, 2016 at 17:18
  • Not impossible. If you disable SELinux permanently (not recommended) you can certainly do it. if you want to keep running SELinux, it will be quite difficult I imagine.
    – MikeA
    Oct 11, 2016 at 17:40
  • @MikeA Do you know anything about this? - LINK
    – ekv_56
    Jun 13, 2020 at 14:25

1 Answer 1


As MikeA commented, if you ran the chcon command in your question you have broken the file labeling in your system. To restore the default file contexts you need to relabel the file system. Reboot the system with SELinux temporarily disabled by appending selinux=0 to kernel command line in GRUB. Then follow steps in CentOS wiki and reboot.

Configuring SELinux to allow samba to read and write any file is quite simple. SELinux policy contains a boolean samba_export_all_rw to do just that. Turn it on with:

semanage boolean --on samba_export_all_rw

For more details how to solve SELinux related file permission issues, I've written a more comprehensive answer to question How to configure SELinux to allow daemons to use files in non-default locations.

  • +sebasth Any ideas - LINK
    – ekv_56
    Jun 13, 2020 at 14:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .