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
You could use groups $username_here | grep -q '\busergroup\b'
groups $username_here | grep -q '\busergroup\b'
The exitcode will be 0 if a match was found, 1 if no match was found.
user_in_group() { groups $1 | grep -q "\b$2\b" }
you could use this function as user_in_group userfoo groupbar
user_in_group userfoo groupbar