[CentOS] how to set a directory to system_u?

Sun Oct 3 22:33:53 UTC 2021
Markus Falb <wnefal at gmail.com>


> On 03.10.2021, at 10:11, hw <hw at gc-24.de> wrote:
> 
> However, ejabberd says in it's log file:
> 
> 
> [error] [...] Cannot store file [...] from [...] permission denied

you are sure that selinux is causing this?
you do have an AVC?

> 
> At least it looks as if ejabberd tries to save the file right where it should but
> can't.
> 
> So why and how can't and can I set the directory to system_u?  Since there are
> directories labled as that, there has to be way to do that.

try -F

```
# restorecon -RF /srv/data/ejabberd/
```

or the manual way

```
# chcon -R -u system_u /srv/data/ejabberd/
```

best regards, markus