Check if a user is in a group

后端 未结 13 1882
梦如初夏
梦如初夏 2021-01-31 02:42

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

相关标签:
13条回答
  • 2021-01-31 03:14

    I know this is probably old thread but just in case this also works well:

    id -Gn "username"|grep -c "groupname"
    

    if any number > 0 is returned then user is a member of that group.

    0 讨论(0)
提交回复
热议问题