Este é o contexto padrão
[root@server ftp]# ll -Zd upload/ drwxr-xr-x. root root unconfined_u:object_r:public_content_t:s0 upload/
Eu tentei este comando para mudar o contexto
[root@server ftp]# semanage fcontext -a -t public_content_rw_t upload/ [root@server ftp]# ll -Zd upload/ drwxr-xr-x. root root unconfined_u:object_r:public_content_t:s0 upload/
[root@server ftp]# restorecon -R -v upload [root@server ftp]# ll -Zd upload/ drwxr-xr-x. root root unconfined_u:object_r:public_content_t:s0 upload/
Não está funcionando, mas esse comando gravará o contexto em /etc/selinux/targeted/contexts/files/file_contexts.local
file
veja aqui
# This file is auto-generated by libsemanage # Do not edit directly. upload/ system_u:object_r:public_content_rw_t:s0
Agora eu tentei este comando ( Comando de trabalho )
[root@server ftp]# semanage fcontext -a -t public_content_rw_t "/var/ftp/upload(/.*)?"
[root@server ftp]# restorecon -R -v upload restorecon reset /var/ftp/upload context unconfined_u:object_r:public_content_t:s0->unconfined_u:object_r:public_content_rw_t:s0
Now context is changed. [root@server ftp]# ll -Zd upload/ drwxr-xr-x. root root unconfined_u:object_r:public_content_rw_t:s0 upload/
Mas eu realmente não sei porque está funcionando, veja a diferença no comando.
Eu recebi a resposta na página do manual de man ftpd_selinux
semanage fcontext -a -t public_content_rw_t "/var/ftpd/incoming(/.*)?"