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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • VinayKumarParakoti
    New Member
    • Nov 2006
    • 6

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

    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
  • kalyanrajsista
    New Member
    • Mar 2008
    • 7

    #2
    It depends on which box you're working on now...windows or *nix.

    The following code works perfectly on windows and unix.
    Code:
    #!/usr/bin/perl
    
    # get logged-in user name
    print "Current user is " . getlogin();
    This will work on Unix...

    Code:
    perl -le 'print scalar getpwuid $<'
    HTH,
    Kalyan Raj

    Comment

    • VinayKumarParakoti
      New Member
      • Nov 2006
      • 6

      #3
      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

      Comment

      Working...