如何检查给定路径是否启用了 POSIX ACL

发布于 2024-11-14 10:48:46 字数 95 浏览 4 评论 0原文

在阅读了 getfacl / setfacl 的手册页后,我找不到一个明显/强大/优雅的方法来检查 (ba)sh 中给定路径是否启用了 acl。

有什么建议吗?

After reading the man page of getfacl / setfacl I could not find an obvious/robust/elegant method to check whether acl is enabled for a given path in (ba)sh.

Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倥絔 2024-11-21 10:48:46
{
  # Determine what the mount point for the path is:
  MOUNT_POINT=$(df -P $FILENAME | tail -n 1 | awk '{print $6}')
  # Get the mount options for the path:
  MOUNT_OPTS=$(awk '$2=="'$MOUNT_POINT'" { print $4 }' /proc/mounts)
  # Check to see if acl is one of the mount points:
  echo $MOUNT_OPTS | tr , \\\n | grep '^acl
 -q
  if [ $? -eq 0 ]; then
    echo "ACLs enabled"
  else
    echo "ACLs disabled"
  fi
}
{
  # Determine what the mount point for the path is:
  MOUNT_POINT=$(df -P $FILENAME | tail -n 1 | awk '{print $6}')
  # Get the mount options for the path:
  MOUNT_OPTS=$(awk '$2=="'$MOUNT_POINT'" { print $4 }' /proc/mounts)
  # Check to see if acl is one of the mount points:
  echo $MOUNT_OPTS | tr , \\\n | grep '^acl
 -q
  if [ $? -eq 0 ]; then
    echo "ACLs enabled"
  else
    echo "ACLs disabled"
  fi
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文