I'm writing a setup script for a server, and I need to show the user the login details for the server. They can be automatically redirected to a web page and I don't know any other details.I want to make a temporary webpage that will have the login details in it, but when the user accesses it it will be deleted from disk and the webserver shuts down.I don't mind installing python or perl or something, but if it could be done in just sh that would be great.Any pointers?
How do I set up a self-destructing web page?
ubuntu;webserver
This is a solution that only needs bash and netcat (traditional version). It's probably really insecure, but for a trusted user it probably works ok.Put this script in webscript.sh.#!/bin/bashfile=wantedfile.htmlhost=localhostwhile [ true ]do  read a  a=`echo ${a} | sed 's/\r//'`  if [ ${a} ==  ]  then    break  fi  command=`echo ${a} | grep Host:`  if [ ${command} !=  ]  then    host=`echo ${a} | awk '{ print $2 }'`  fidonelen=`ls -la ${file} | awk '{ print $5 }'`echo HTTP/1.1 200 OKecho Host: ${host}echo Content-Length: ${len}echo cat ${file}rm ${file}Then you just need to use netcat:nc.traditional -e 'webscript.sh' -l -p 80