Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Identifying a web site visitor

Posted by enquirer (enquirer), 21 November 2003
I am having great difficulty trying to get the username of a user currently logged in, using perl CGI in netscape. I tried using

$ruser   = "$ENV{'REMOTE_USER'}"

but this doesn't work. I know it's possible, because I've seen other pages here that can extract the information. Actually - I copied the above line from one of them... but it still doesn't work in my program 

Can you help?

Posted by admin (Graham Ellis), 21 November 2003
The web is DESIGNED to make this difficult ....

Although there's a REMOTE_USER field in the environment, it only works on internal networks (intranets) where the identd daemon is running on the client's computer, which is pretty rare.  It may work within your place of work, but if you're writing general pages on the internet it will be VERY rare for you to get a user name.

Why isn't the user name more easily available?   Because if I could get your user name when you visit my web site, I could then add you to my mailing list and send you spam.   And so you would be put off visiting any new web sites.  Thus the CGI interface is designed to give web site owners excellent marketing information (to tell them about their visitors without identifying them) but no sales information (to prevent them making up mailing lists).

If you want / need to identify a user, you could get them to log in to your website and then set and use a cookie.  If you're looking to run your code on your internal network, you could also try fingering the visiting host and finding out who's logged on ... do most machines run finger?

Just some further thoughts ... no easy solution.  As an educated guess, the program you've copied from runs internally with one group of users and the program you're writing is with an different group or even external.

This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: • WEB: • SKYPE: wellho