Thanks Alan (and Mats)! It appears there are many ways to skin this cat!
On Sat, Aug 26, 2017 at 2:21 AM, Alan Gauld via Tutor wrote:
>
>> My objective: Determine who the currently logged in user is and
>> determine if that user is in my list of users that I have authorized
> My objective: Determine who the currently logged in user is and
> determine if that user is in my list of users that I have authorized
> to use my programs.
In addition to Steve and Mats answers:
import os
os.getlogin() #-> 'alan'
os.getuid() #-> 1001
import pwd
pwd.getpwuid(os.getuid())
On Fri, Aug 25, 2017 at 8:33 PM, Steven D'Aprano wrote:
> On Fri, Aug 25, 2017 at 07:13:12PM -0500, boB Stepp wrote:
>
>> My objective: Determine who the currently logged in user is
>
> py> import os
> py> os.getlogin()
> 'steve'
Sweet! Much better. I did not scan the os
import getpass
getpass.getuser ()
depending on how fussy you want to be...
On August 25, 2017 6:13:12 PM MDT, boB Stepp wrote:
>SunOS 5.10, Python 2.4/2.6
>
>I ask forgiveness in advance as I cannot copy and paste into an email
>what I am doing on this system. So I
On Fri, Aug 25, 2017 at 07:13:12PM -0500, boB Stepp wrote:
> My objective: Determine who the currently logged in user is
py> import os
py> os.getlogin()
'steve'
> and
> determine if that user is in my list of users that I have authorized
> to use my programs.
That's probably best handled at
SunOS 5.10, Python 2.4/2.6
I ask forgiveness in advance as I cannot copy and paste into an email
what I am doing on this system. So I will have to manually type
things, introducing the usual possibility of typos.
My objective: Determine who the currently logged in user is and
determine if that