Finding Username of the machine from which rails app accessed

Hi All,
        Can anybody tell me, is there any way that i can find the name
of the computer/machine rather than ip of the machine, from where a
user is accessing my rails application?

I was asked to do some research on this...please help.

observe request parameters but i dont think its giving machine name

i m not sound on rails, but if U take a look to this site it not able to access machine name.

i think U using either this gem or any other derived gem .

form my knowledge there is not option to get machine name.

request.env[‘REMOTE_HOST’] should be the closest to what you want.

Gautam Pai

The exact requirement is, the rails app will be hosted in the lan
itself. And when the user/employee opens the home page of the
application, an action should be triggered and it should fetch the
logged in user name(here logged name means the user who is using the
machine), and the same thing(saying so and so user logged in) should
be noticed to the admin.

One idea i am having is if it is a linux machine i have to use the
'who' command and parse the output. but what for windows system? And
what are the ways to execute the linux commands in a rails app?

Anybody come across this sort of situation already?

The simple fact of the matter is that Rails applications run within a browser and you can't run any system commands from within the browser. Your idea of running "who" from within the browser won't work and if you do it from within your Rails app, it will just return the logged in user on the server (where your Rails app is running).

In fact, there is very little you can find out about the system itself from within a browser for security reasons. Imagine the fun malicious code developer would have if a browser would enable you to access that kind of information.

The only way to "detect" who is using your intranet web application is by having them log in from within the browser somehow. Whether that's through a login and password, some single sign-on scheme like OpenID or some time-limited generated key (e.g. DigiPass, …) is up to you.

Best regards

Peter De Berdt

If your users are all on Windows, apparently it's possible to tie into
NTLM authentication:

Never tried this, but it may work. Once you've got a username, you may
want to use something like ActiveLDAP to grab more info from your
Active Directory server.

--Matt Jones