Ruby Forum JRuby > Get current user logged-in to local computer

Posted by Partogi, Joshua (Guest)
on 07.05.2008 04:18
(Received via mailing list)
Dear all,

Would it be possible to get the current user that logged into local 
computer
with Ruby? I'm building an intranet apps and would like to get the 
username
that logged into the computer they are using.

Thanks in advance

IMPORTANT NOTICE:
The information in this email (and any attachments) is confidential. If 
you are not the intended recipient, you must not use or disseminate the 
information. If you have received this email in error, please 
immediately notify me by "Reply" command and permanently delete the 
original and any copies or printouts thereof.  Although this email and 
any attachments are believed to be free of any virus or other defect 
that might affect any computer system into which it is received and 
opened, it is the responsibility of the recipient to ensure that it is 
virus free and no responsibility is accepted by American International 
Group, Inc. or its subsidiaries or affiliates either jointly or 
severally, for any loss or damage arising in any way from its use.
Posted by Vladimir Sizikov (Guest)
on 07.05.2008 09:25
(Received via mailing list)
Hi Joshua,

On Wed, May 7, 2008 at 4:17 AM, Partogi, Joshua <Joshua.Partogi@aig.com> 
wrote:

> Would it be possible to get the current user that logged into local computer
> with Ruby? I'm building an intranet apps and would like to get the username
> that logged into the computer they are using.

You can do the following:
1.

ENV['USER']  on Unix
ENV['USERNAME'] on Windows

2.

require 'etc'
Etc.getlogin  (on all platforms)

Thanks,
  --Vladimir

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email