Sunday 15 April 2012

http - Passing basic auth username to a shell script -


I have a strange requirement that I have a webserver setup with http basic auth pass the user's name and / or password Any way to do a user enters the shell script with the environment?

I know that Apache has this information because I can see it in the access_log and error_log files. I am mainly interested in username, so I can store it in a txt files on a certified login

If you have PHP, then this information is available in $ _SERVER Super Global, so that you can do this:

  file_put_contents ('/ path / to / log / file', $ _SERVER ['REMOTE_USER']. "\ N", FILE_APPEND);    

No comments:

Post a Comment