Re: get user name
by redsquirrel (Hermit) on Jan 21, 2002 at 19:53 UTC
|
You could try $ENV{REMOTE_USER}. Not sure how generic that is, but it works on our Solaris boxes.
--Dave | [reply] [d/l] |
|
| [reply] [d/l] [select] |
|
Thanks for the helpful explanation vagnerr. The tidbits of useful knowledge that come from posts like yours are one of the great values that PM provides.
++ to you!
--Dave
| [reply] |
Re: get user name
by schumi (Hermit) on Jan 21, 2002 at 21:42 UTC
|
If the person logged on to a .htaccess-wise protected website, and your script is using CGI.pm, remote_user() should also do the trick.
However, this doesn't work if you're wanting to get the username of a person logged on to a network (i.e. not onto a webserver).
--cs
There are nights when the wolves are silent and only the moon howls. - George Carlin | [reply] [d/l] |
Re: get user name
by z3d (Scribe) on Jan 21, 2002 at 23:47 UTC
|
Not that you've probably had a chance to get back to all of these suggestion, but I agree with a previous post - it all depends on the circumstances. Can you get us more information on the environment, both where you want to place the perl application and what kind of network it will live on? I know that in the past I've used the LDAP module to get user information against the Microsoft Directory server or Netscape's LDAP server, but in both cases it was based on some combination of $ENV{YADA} variables. If this isn't coming through a web server, it does get more difficult.
That said, I notice you mentioned cgi or asp, so I guess it is coming through a web server =:) Check out the ENV variables that are available. You may not be able to get the exact username if it hasn't been authenticated, but you may be able to pull something else out that is unique. For instance, if this is a closed and limited system, you will be able to get their machine name, which in closed networks tends to be a unique identifier.
Consider anything you might see in a web server log and that will get you close to a solution.
z3d | [reply] |
|
Thought of one more thing to add (I know, it's bad when you reply to your own reply) - you mentioned ASPs, which implies an MS network. IF I remember right, and it's been a long time, ASP's at least (can't remember if this is an MS specific thing or if it was in the ENV variables) can grab the network logon name from the incoming user - assuming your application is on an MS network, MS server, etc.
***************************************************************
Zed? Zed's dead, baby, Zed's dead.
| [reply] |
|
Thought of one more thing to add (I know, it's bad when you reply to your own reply) - you mentioned ASPs, which implies an MS network. IF I remember right, and it's been a long time, ASP's at least (can't remember if this is an MS specific thing or if it was in the ENV variables) can grab the network logon name from the incoming user - assuming your application is on an MS network, MS server, etc.
***************************************************************<br<
Zed? Zed's dead, baby, Zed's dead.
| [reply] |
Re: get user name
by thunders (Priest) on Jan 21, 2002 at 19:19 UTC
|
| [reply] |