Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of building ftp server by docker pure-ftp

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1. Using docker-compose to build ftp server

The content of docker-compose.yml is as follows

Ftp: image: stilliard/pure-ftpd volumes:-".. / wp/app:/home/ftpusers/code"-". / pure-ftpd:/etc/pure-ftpd" ports:-"21:21"-"3000000VV 30000"-"30001RV 30001"-"30002RV 30002"-"30003Rover 30003"-"30004ROR 30004"-"30005Rule 30005"-"30006Rod 30006"-"30007Rule 30007" "-" 30008RV 30008 "-" 30009RU 30009 "environment: PUBLICHOST: localhost

When the server can connect to the Internet, it can be executed directly under the directory where the docker-compose.yml is located:

$docker-compose up-d

You can build the server directly. If the server cannot connect to the public network, you need to load the prepared stilliard/pure-ftpd:latest image (such as pure-ftpd.tar) into the server.

$docker load-I pure-ftpd.tar

two。 Add virtual users to the ftp server

First, you can add appropriate users and groups, such as user ftpuser and group ftpgroup, to the system.

$groupadd ftpgroup$ useradd ftpuser-g ftpgroup-d / home/ftp-s / sbin/nologin

It can also be a user who can log on to the system, but it is best to be a user who cannot log in to the system.

Then use the pure-pw command to add a virtual user, such as the virtual user user1, and specify the viewing directory as / var/www/site1.

$pure-pw useradd user1-u ftpuser-g ftpgroup-d / var/www/site1

Another: a system user can bind multiple virtual users and then control the directory being viewed. If you add the virtual user user2 again, and specify the viewing directory as / var/www/site2

$pure-pw useradd user2-u ftpuser-g ftpgroup-d / var/www/site2

After pure-pw, you will be asked to enter a password, that is, to set the password for logging in to the ftp user. After adding, let pure-ftpd create virtual user data

$pure-pw mkdb

When this is over:

$/ etc/init.d/pure-ftpd restart

When I add virtual users, executing [/ etc/init.d/pure-ftpd restart] in the container does not work, and then the restart of the ftp server container is executed before it can be used normally. Readers are advised to try more when using this method to build ftp servers.

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report