You only need to write a python script, such
Vim smiple_ftp_by_python.py
Write the following script and save it: wq
Import SimpleHTTPServer
Import SocketServer
PORT = 8000
Handler = SimpleHTTPServer. SimpleHTTPRequestHandler
Httpd = SocketServer. TCPServer ("", PORT), Handler)
Print "serving at port", PORT
Httpd. serve_forever ()
Then run
Python smiple_ftp_by_python.py
You can directly access http: // hostip: 8000 Is it amazing to access this directory? It's super simple. Haha, the basic linux release version will be pre-installed with python, and there is no need to install any program. However, it can only implement read-only functions and users can access it. the directory is the directory of the current folder and its sub-directories. If you directly drop this script to the root directory/for execution, then visitors can directly access the entire linux directory, isn't it very is it convenient? haha. However, if you can access certain files or directories, it depends on the user permission when you run this script. If you throw this script to the root directory, you can run it as root or as a user. so all the tourists can view any files or directories,
If you use Ctrl + C to end the program and restart the program, it may cause a port usage error because the previous program is still using port 8000, you can use the following command to end the port occupation
Kill-9 'fuser-n tcp 8000'