Get current user logged-in to local computer

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.

Hi Joshua,

On Wed, May 7, 2008 at 4:17 AM, Partogi, Joshua [email protected]
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

require ‘etc’
Etc.getlogin (on all platforms)

Thanks,
–Vladimir


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
1 Like