By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,852 Members | 1,426 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,852 IT Pros & Developers. It's quick & easy.

get client's login name using perl. Is this possible?

P: 6
Hi All,


I am trying to get the login name of client's machine using Perl.
I was under impression that getlogin() will do the job. But this is not giving correct results.


Could anypne please help me in finding solution for the same.

Thanks in advance.

Cheers,
Vinay
Mar 27 '08 #1
Share this Question
Share on Google+
2 Replies


kalyanrajsista
P: 7
It depends on which box you're working on now...windows or *nix.

The following code works perfectly on windows and unix.
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2.  
  3. # get logged-in user name
  4. print "Current user is " . getlogin();
  5.  
  6.  
This will work on Unix...

Expand|Select|Wrap|Line Numbers
  1. perl -le 'print scalar getpwuid $<'
  2.  
HTH,
Kalyan Raj
Mar 28 '08 #2

P: 6
Hi All,

Thanks for the response.

I have found out what the exact problem is.

As our friend said, and even I was trying, getlogin() is working perfectly.

The problem is like this:

We are using IIS server with anonymous login.
As you all know, the anonymous login will have a common login name IUSR_servername.

This is what even I am getting now when I try to retrieve the login name.

According to the restrcitions I have, I cannot change the settings in the server.
But I am able to get the ip address of the client machine.

Is there any possible way that I can get the login name of the client PC using ip address.

Thanks in advance for help.

Cheers,
Vinay
Mar 31 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.