Created on 2003-01-31 11:23 by yoda_gh, last changed 2003-02-03 15:42 by akuchling. This issue is now closed.
|msg14318 - (view)||Author: Gernot Hillier (yoda_gh)||Date: 2003-01-31 11:23|
I experienced problems when using os.getlogin(). It doesn't work for exmaple after doing a "su". It still reports the old login. Also "man 3 getlogin" tells me on GNU/Linux (SuSE 8.1): "Unfortunately, it is often rather easy to fool getlogin(). Sometimes it does not work at all, because some program messed up the utmp file. Often, it gives only the first 8 characters of the login name. The user currently logged in on the controlling tty of our program need not be the user who started it. Avoid getlogin() for security-related purposes. Nobody knows precisely what cuserid() does - avoid it in portable programs - avoid it altogether - use getpwuid(geteuid()) instead, if that is what you meant. DO NOT USE cuserid()" It would be nice if you could add some warning to the documentation of Python's os.getlogin() telling the user it's better to use "pwd.getpwuid(os.getuid())". That's at least what I do now and it works as expected. TIA!
|msg14319 - (view)||Author: A.M. Kuchling (akuchling) *||Date: 2003-02-03 15:42|
Logged In: YES user_id=11375 Checked in to rev. 1.110 of libos.tex; thanks!