大网数据广告活动
服务器运维问答

Show quota limit of user's home directory

· 52CE 我爱测

What I am trying to do is to get quota limit of current system user's home directory, which is btrfs quota-enabled, using the following command: /usr/sbin/btrfs qgroup show-reF ~/ The above command outputs the following error: ER…

问题原文

原帖链接 · Keram Yasin · CC BY-SA 4.0

What I am trying to do is to get quota limit of current system user's home directory, which is btrfs quota-enabled, using the following command:

/usr/sbin/btrfs qgroup show-reF ~/

The above command outputs the following error:

ERROR: can't list qgroups: Operation not permitted

Above command works well for root user. But I wanted to allow users to check the disk usage of their home directory as their is quota limit on users home directory.

I added the user to group of /usr/sbin/btrfs command, but it did not help. can anybody explain the cause of the error? and probably how to resolve it?

已采纳解答

原帖链接 · U880D · CC BY-SA 4.0

With the currently given information and because of the nature of BTRFS Quota groups

... Above command works well for root user ... Can anybody explain the cause of the error?

the command needs to run under higher rights, as root. See in example the thread under How to display quota limit on BTRFS subvolume?.

But I wanted to allow users to check ...

In order to do so you could allow all users to run a given command via sudo and would need to add to the /etc/sudoers file in example

ALL ALL=NOPASSWD: /usr/sbin/btrfs qgroup show-reF ~/

which can then just be executed by the user via

sudo /usr/sbin/btrfs qgroup show-reF ~/

You may also think about to introduce an alias for the command with Cmnd_Alias and see How do I use command arguments with Cmnd_Alias in sudoers?

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2023-09-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。