RHEL6とCentOS6でクォータを設定できません。 quotecheckはエラーメッセージを返します。

RHEL6とCentOS6でクォータを設定できません。 quotecheckはエラーメッセージを返します。

RHEL6とCentOS6でクォータを設定できません。 quotecheckはエラーメッセージを返します。

新しいパーティション(/dev/sda6)を作成し、それをマウントしました(/ hulkに)。

次の行を使用して /etc/fstab ファイルを編集して、パーティションにクォータを提供します。

/dev/sda6   /hulk   ext4   defaults,usrquota,grpquota    0 0

そして次のような命令を出した

[root@localhost ~]# mount -o remount,rw /hulk

[root@localhost ~]# mount|grep hulk
/dev/sda6 on /hulk type ext4 (rw,usrquota,grpquota)

[root@localhost ~]# cd /hulk

[root@localhost hulk]# ls
lost+found

quotacheckコマンドを使用すると、次のエラーメッセージが表示されます。

[root@localhost hulk]# quotacheck -cug /hulk
quotacheck: Cannot create new quotafile /hulk/aquota.user.new: Permission denied
quotacheck: Cannot initialize IO on new quotafile: Permission denied
quotacheck: Cannot create new quotafile /hulk/aquota.group.new: Permission denied
quotacheck: Cannot initialize IO on new quotafile: Permission denied

ベストアンサー1

許可モードで一度実行し、可能性のある違反を検索するか、すべての違反が見つかるまでプロセスを繰り返します。

ausearch -c 'quotaon' --raw | audit2allow -M my-quotaon
semodule -i my-quotaon.pp

これにより、すべての違反を検索し、それを可能にする適切なselinuxモジュールが作成されます。動作するまでこの手順を繰り返すことができます。

これが私がFedora 24で思いついたものです。インストール/home時にクォータが有効になっています。

module my-quotaon 1.0;

require {
    type fs_t;
    type quota_exec_t;
    type home_root_t;
    type init_t;
    type quota_db_t;
    class file { execute execute_no_trans open quotaon read };
    class filesystem { quotaget quotamod };
}

#============= init_t ==============

#!!!! This avc is allowed in the current policy
allow init_t fs_t:filesystem { quotaget quotamod };

#!!!! This avc is allowed in the current policy
allow init_t home_root_t:file read;
allow init_t quota_db_t:file quotaon;

#!!!! This avc is allowed in the current policy
allow init_t quota_db_t:file { open read };

#!!!! This avc is allowed in the current policy
allow init_t quota_exec_t:file { execute execute_no_trans open read };

おすすめ記事