Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get Windows Login name from within a CGI

Status
Not open for further replies.

J1mbo

Programmer
Dec 12, 2002
93
0
0
US
Ok,

i'm new to programming in perl to interface with windows systems. All of my experience is with Unix systems. Here is my question:

Is there a module or method that can determine what the Windows login name is for a person who visits a webpage?

I'm trying to create a login page that already knows the windows login, and only requires a password to be entered.
This is a user requirement, not mine btw. thanks,

 
$ENV{'LOGNAM'} shoudl be what you're looking for

HTH
--Paul

Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Sorry, That doesn't work for me.

I should mention that the script runs on a Unix server with Apache as the webserver. I don't have the LOGNAM variable.

So far I'm able to determine the IP and hostname by using Unix utilities. I may need to pose this question in another forum to see if there is a way to match the IP to Windows login name through Active Directory.

Thanks,

 
you maybe want to be looking at using the Win32 modules.
 
Hi

So you want that your CGI script running on one computer to guess the name of the user logged in on another computer ? And the only communication between the two computers is through HTTP protocoll ? I hope there is no way to do this.

I suggest to keep the last used user name in a cookie, so the visitor will have to enter it only once.

Feherke.
 
There's /no/ way to do that. This question was asked without giving enough information so I am left to assume it's for malicious activities.

There is zero reason the computer login information of a Windows or any other OS user should be should be attainable. If this is an intranet there are probably ways to use Perl to do it but CGI (over the web) cannot access such information. That'd be too much of a security risk.
 
I assure you it's not for 'malicious activities'. I have a good standing on this forum.

My supervisor swears that this could be done and I told him that it probably cannot. I asked the question because i don't program ever to interface with M$ windows and was looking for some clarification [thanks all].

I like the above idea of using a cookie to capture the information so that the users don't have to login more than once to my page. I'll use that and tell my boss that his idea won't work.

 
Hi

Ok, if you say that you administrate both machines, then could try one thing. I think the Windows should be NT, 2k or XP for this, to have a possibility to run a command after logging in. You have to put a batch file in a specified directory ( no idea which ) with this content :
Code:
rem currentuser.bat
echo var currentuser='%USERNAME%'; > c:\currentuser.js
Then your HTML document could load it :
Code:
<html>
<head>
<script type="text/javascript" src="c:/currentuser.js"></script>
</head>
<body onload="document.login.name.value=currentuser">
<form action="/cgi-bin/login.cgi">
<input type="text" name="user">
<input type="password" name="pass">
<input type="submit">
</form>
</body>
</html>
Of course, no guarantee that will work everywhere. Could depend on security level settings and/or installed service packs.

Sorry for the offtopic. By the way, I would not do it, even if seems to work.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top