Skip to contentSkip to conversation

display project quota as user

PATCH Andre Noll 2 participants 3 messages Mar 14, 2012 – Mar 15, 2012 Diskquota

lore
Share & tools
lore

Andre Noll

author
#0 lore raw

Simple question: Can non-privileged users display XFS project quotas?

Currently the command

	xfs_quota -c 'quota -p 42'

fails when executed as a non-root user due to quotactl(Q_XGETQUOTA,...) returning EPERM. The problem seems to be that fs/quota/quota.c has no knowledge of project quotas at all.

The proof-of-concept patch below makes quotactl(Q_XGETQUOTA,...) succeed for any user when called with type == XQM_PRJQUOTA. However, relaxing the permission checks like this might not please everybody, changes semantics of an existing API and adds the XFS specific constant XQM_PRJQUOTA to fs/quota.c. So I'm not even asking to apply something like that.

Is there a better way to allow users to display project quotas?

Thanks
Andre
---

fs/quota/quota.c +2 -1
index fc2c438..010763d 100644
@@ -33,7 +33,8 @@ static int check_quotactl_permission(struct super_block *sb, int type, int cmd,
 	case Q_GETQUOTA:
 	case Q_XGETQUOTA:
 		if ((type == USRQUOTA && current_euid() == id) ||
-		    (type == GRPQUOTA && in_egroup_p(id)))
+		    (type == GRPQUOTA && in_egroup_p(id)) ||
+		    (type == XQM_PRJQUOTA))
 			break;
 		/*FALLTHROUGH*/
 	default:
Signature · 1 line
The only person who always got his work done by Friday was Robinson Crusoe

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw
Quoted 9 lines · Andre Noll

Simple question: Can non-privileged users display XFS project quotas?

Currently the command

	xfs_quota -c 'quota -p 42'

fails when executed as a non-root user due to quotactl(Q_XGETQUOTA,...) returning EPERM. The problem seems to be that fs/quota/quota.c has no knowledge of project quotas at all.

Right - only XFS supports project quotas.

Quoted 8 lines

The proof-of-concept patch below makes quotactl(Q_XGETQUOTA,...) succeed for any user when called with type == XQM_PRJQUOTA. However, relaxing the permission checks like this might not please everybody, changes semantics of an existing API and adds the XFS specific constant XQM_PRJQUOTA to fs/quota.c. So I'm not even asking to apply something like that.

Is there a better way to allow users to display project quotas?

There is no user <=> projid mapping that exists, so either the information is available to everyone, or it is available only to root. In this case, system wide quota reports are limited to root, and I don't see that changing.

If you really must allow users to see project quota limits, then write a simple wrapper program and allow only the users that need the infomration to execute it via sudo....

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
author
#2 lore raw
Quoted 10 lines · Dave Chinner
Quoted 1 line

Is there a better way to allow users to display project quotas?

There is no user <=> projid mapping that exists, so either the information is available to everyone, or it is available only to root. In this case, system wide quota reports are limited to root, and I don't see that changing.

If you really must allow users to see project quota limits, then write a simple wrapper program and allow only the users that need the infomration to execute it via sudo....

OK, will do that. Thanks for the clarification.

Andre

Signature · 1 line
The only person who always got his work done by Friday was Robinson Crusoe

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs