Is current user member of group www-data ?

Gribouillis

The title says it all.

214 Views
About the Author

Mind explorer.

# 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 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.