Super simple. You don't need samba. You don't need any FTP software or clients.

Source: Internet
Author: User

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'
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.