[Gllug] Shutdown Stopped

Jason Clifford jason at ukpost.com
Sat Oct 19 13:05:04 UTC 2002


On 19 Oct 2002, Walid Shaari wrote:

> > A feature i'd like to add but i'm not too sure about how to do is to grab
> > the user name of the culprit. I tried getting it from $HOME but this gets
> > changed to '/' when the command is executed due to it changing uid to root
> > (I assume). Anyone have any suggestions on how to do this?
> 
> In python2.2 it is in the standard library os module, os.getlogin() as
> opposed to os.geteuid(),I am sure there is something similar in perl
> even if its written using cryptic symbols like $:-(

perl -e 'print getlogin;'

perldoc -f getlogin 

       getlogin
               Implements the C library function of the same
               name, which on most systems returns the current
               login from /etc/utmp, if any.  If null, use "getp-
               wuid".

                   $login = getlogin || getpwuid($<) || "Kilroy";

               Do not consider "getlogin" for authentication: it
               is not as secure as "getpwuid".

$< is the real uid of the current process.
$> is the effective uid of the current process.

Jason Clifford
-- 
UKPOST.COM	 	           get your @ukpost.com address now...
http://www.ukpost.com/	 	   professional hosting and colocation


-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list