# Determine user/computer name

**URL:** <https://www.ruby-forum.com/t/determine-user-computer-name/123452>\
**Category:** Rails\
**Created:** [December 17, 2007, 9:57pm UTC](https://www.ruby-forum.com/t/determine-user-computer-name/123452 "2007-12-17T21:57:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anthony](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/49beb7/32.png) [@anthony](https://www.ruby-forum.com/u/anthony)\
**Post date:** [December 17, 2007, 9:57pm UTC](https://www.ruby-forum.com/t/determine-user-computer-name/123452/1 "2007-12-17T21:57:29Z")

</div>

Is it possible to somehow get the computer name or Windows user name  
of the person accessing my internal web page? I can get the remote IP  
address, but what I really need is the remote user or computer name.

---

<div class="post-metadata">

**Author:** ![anthony](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/49beb7/32.png) [@anthony](https://www.ruby-forum.com/u/anthony)\
**Post date:** [December 17, 2007, 11:48pm UTC](https://www.ruby-forum.com/t/determine-user-computer-name/123452/2 "2007-12-17T23:48:52Z")

</div>

Um. no. That information is not transmitted through any browser as it  
poses  
a very large security risk.

On Dec 18, 2007 7:26 AM, Anthony [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Is it possible to somehow get the computer name or Windows user name  
> of the person accessing my internal web page? I can get the remote IP  
> address, but what I really need is the remote user or computer name.
> 
> >

–  
Ryan B.

> **[frozenplague.net](http://www.frozenplague.net)**
>
> This domain may be for sale!

---

<div class="post-metadata">

**Author:** ![anthony](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/49beb7/32.png) [@anthony](https://www.ruby-forum.com/u/anthony)\
**Post date:** [December 18, 2007, 12:01am UTC](https://www.ruby-forum.com/t/determine-user-computer-name/123452/3 "2007-12-18T00:01:45Z")

</div>

That’s what I had thought. However, someone else said they can get  
that information using javascript (ActiveXObject) or something with  
VBScript (I think through a shell). Also, I can get the remote IP  
address and trace it back (using system), and since it’s on an  
internal network it will show me a computer name. I was hoping there  
would be an easier or more convenient way to get the info using Ruby/  
Rails or command shell.

---

<div class="post-metadata">

**Author:** ![anthony](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/49beb7/32.png) [@anthony](https://www.ruby-forum.com/u/anthony)\
**Post date:** [December 18, 2007, 3:30pm UTC](https://www.ruby-forum.com/t/determine-user-computer-name/123452/4 "2007-12-18T15:30:57Z")

</div>

Thanks for the extra info. Resolv does work, however, the reverse  
lookup is not correct for a few of our IP addresses. I can’t do  
anything about the incorrect lookups, so I need some kind of  
workaround.

---

<div class="post-metadata">

**Author:** ![anthony](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/49beb7/32.png) [@anthony](https://www.ruby-forum.com/u/anthony)\
**Post date:** [December 18, 2007, 12:05am UTC](https://www.ruby-forum.com/t/determine-user-computer-name/123452/5 "2007-12-18T00:05:51Z")

</div>

> That’s what I had thought. However, someone else said they can get  
> that information using javascript (ActiveXObject) or something with  
> VBScript (I think through a shell). Also, I can get the remote IP  
> address and trace it back (using system), and since it’s on an  
> internal network it will show me a computer name. I was hoping there  
> would be an easier or more convenient way to get the info using Ruby/  
> Rails or command shell.

If you just need the hostname of the computer and your reverse DNS is  
setup right just use the ‘resolv’ library to look it up.

-philip
