Check if a user is in a group

后端 未结 13 1896
梦如初夏
梦如初夏 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 02:56

    Using the zero delimiter to split by lines:

    id -nGz user | tr '\0' '\n' | grep '^group$'
    

提交回复
热议问题