Thursday, January 9, 2014

Rescue data with Simple HTTP Server

Had Rhel system VM that crashed during a yum update then would not boot due to a kernel panic.  Had 3 kernels listed in Grub and the system would panic on each until oldest kernel let me login in as single user for maintenance. Before going on with troubleshooting and recovery etc I wanted to save my data just in case. I could not hook up an external drive so I took a shot at starting the network and it started right up.  With that done I tried starting ssh but it would not start, the sshd.config file was corrupted and the ssh service completely missing from init.d.  So I opted on recovering my data using the “Really Simple HTTP Server” in Python.  This was not only simple but it worked great.

Python and SimpleHTTPServer may already be installed by default on a RHEL6 system on RHEL6, they are on our build. To use use just do the following:



$ cd /home/somedir$ python -m SimpleHTTPServer

Now the http server will start on port 8000.
You should see:
Serving HTTP on 0.0.0.0 port 8000 ...

From a browser on another system connect with http and IP of the target system:
http://xxx.xxx.xxx.xxx:8000 and you will see you files and sub-directories in the directory you are running SimpleHTTP.

You can only download individual files not directories so if need be tar up the files you want and down load the tar.


This is also a great and easy way to get files in lieu of scp, just don't leave the Simple HTTP Server running, probably not very secure.


REF: http://www.linuxjournal.com/content/tech-tip-really-simple-http-server-python

No comments:

Post a Comment