本文介绍了击:检查,如果用户是一组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我跑,我使用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更多推荐
击:检查,如果用户是一组
发布评论