击:检查,如果用户是一组

编程入门 行业动态 更新时间:2024-10-11 15:21:01
本文介绍了击:检查,如果用户是一组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我跑,我使用PHP运行bash脚本来验证用户的特定信息的服务器。例如,我有一个虚拟主机服务器架设,并且为了能够到其他域添加到他们的帐户,我要验证用户是否确实是客户组的成员。什么是做到这一点的最好方法是什么?

I have a server running where I use php to run a bash script to verify certain information of a user. For example, I have a webhosting server set up, and in order to be able to add another domain to their account I want to verify if the user is actually a member of the 'customers' group. What would be the best way to do this?

我已搜查谷歌,但都说到了是方式请检查是否一个用户或组存在,所以谷歌是不是一个很大的帮助,现在。

I have searched google, but all it comes up with is ways to check wether a user or a group exists, so google is not being a big help right now.

任何帮助将大大AP preciated。

Any help would be greatly appreciated.

推荐答案

试着做这样的:

username=ANY_USERNAME if getent group $username | grep &>/dev/null '\bcustomers\b'; then echo true else echo false fi

username=ANY_USERNAME if groups $username | grep &>/dev/null '\bcustomers\b'; then echo true else echo false fi

更多推荐

击:检查,如果用户是一组

本文发布于:2023-11-28 11:58:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1642315.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:用户

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!