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

On Mon, Dec 26, 2011 at 3:29 PM, venkata reddy
[email protected]wrote:

To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


sαη∂ιρ Rαηѕιηg


www.funonrails.com

twitter, github @sandipransing
skype sandip.ransing

i m not sound on rails, but if U take a look to this site it not able to
access machine name.
http://iplocationtools.com/
http://www.ipaddresslocation.org/

i think U using either this gem http://geokit.rubyforge.org/index.html
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 P.

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?

On 26 Dec 2011, at 13:55, venkata reddy wrote:

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?

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

On Dec 26, 7:55am, venkata reddy [email protected] wrote:

Anybody come across this sort of situation already?

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

http://blog.rayapps.com/2008/12/02/ntlm-windows-domain-authentication-for-rails-application/

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 J.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs