Is current user member of group www-data ?

Updated Gribouillis 0 Tallied Votes 239 Views Share

The title says it all.

# python 2 or 3, linux only
# AUTHOR: Gribouillis for the python forum at www.daniweb.com
import grp
import os
import pwd

if pwd.getpwuid(os.getuid()).pw_name in grp.getgrnam('www-data').gr_mem:
	print("current user is a member of group www-data")
golamkibria 0 Newbie Poster

so good looking

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.