Python quickly builds a simple FTP server
As mentioned last time, use python to build a simple web download server, but this simple server client cannot upload files. This time to build a simple ftp server to provide file download and upload functions.
First, let's install the pyftpdlib module that provides services.
Pip install pyftpdlib
Second, then run the pyftpdlib module as a simple stand-alone server through the-m option of python. At this point, if we want to share that directory, just run the command in that directory.
Python-m pyftpdlib
-m starts as a module
Verify:
At this point, a simple FTP server has been successfully built, visit: ftp://ip:port can provide download function. But it can only be downloaded here, so the default permission of the server is read-only, the login method is anonymous, and the default port is 2121.
3. If we want to build one with password authentication and write permission, we can use the following command:
Python-m pyftpdlib-I 10.39.1.4-w-d / zhangsan-u zhangsan-P yaun
-I specify the IP address (default IP address available locally)
-w write permissions (default read)
-d shared directory
-u specifies a logged-in user
-P specify login password
Test verification:
Upload files
So far, we have completed all the requirements for building the server, downloadable, writable, and authenticated login. Very simple!