File tree 4 files changed +90
-0
lines changed
4 files changed +90
-0
lines changed Original file line number Diff line number Diff line change
1
+ .git
Original file line number Diff line number Diff line change
1
+ # # -*- docker-image-name: "mauler/simple-ftp-server" -*-
2
+
3
+ FROM python:slim
4
+ MAINTAINER Paulo <
[email protected] >
5
+
6
+ ENV FTP_ROOT /ftp-home
7
+ ENV FTP_USER ftp
8
+ ENV FTP_PASS ftp
9
+ ENV FTP_PORT 21
10
+
11
+ VOLUME /ftp-home
12
+
13
+ ADD image/root/ /
14
+
15
+ RUN pip install pyftpdlib && \
16
+ mkdir -pv $FTP_ROOT
17
+
18
+ EXPOSE $FTP_PORT
19
+
20
+ ENTRYPOINT /bin/simple-ftp-server
Original file line number Diff line number Diff line change
1
+ simple-ftp-server
2
+ ===================
3
+
4
+ Simple FTP server using pyftpdlib, for simple use case eg upgrade your wordpress plugins locally.
5
+
6
+ Based on:
7
+
8
+ https://github.com/giampaolo/pyftpdlib/blob/master/demo/basic_ftpd.py
9
+
10
+
11
+ How to use
12
+ ----------
13
+
14
+ Simple command line usage:
15
+
16
+ ```
17
+ docker run -p 11021:21 -it --rm -e FTP_USER=scott -e FTP_PASS=tiger -e mauler/simple-ftp-server
18
+ ```
19
+
20
+ You can test using:
21
+ ```
22
+ ftp localhost 11021
23
+ ```
24
+
25
+ * Based on image m-creations/docker-openwrt-ftp*
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+
3
+ from os import environ
4
+
5
+ from pyftpdlib .authorizers import DummyAuthorizer
6
+ from pyftpdlib .handlers import FTPHandler
7
+ from pyftpdlib .servers import FTPServer
8
+
9
+
10
+ def main ():
11
+ # Instantiate a dummy authorizer for managing 'virtual' users
12
+ authorizer = DummyAuthorizer ()
13
+
14
+ # Define a new user having full r/w permissions and a read-only
15
+ # anonymous user
16
+ authorizer .add_user (environ ['FTP_USER' ],
17
+ environ ['FTP_PASS' ],
18
+ environ ['FTP_ROOT' ], perm = 'elradfmwM' )
19
+
20
+ # Instantiate FTP handler class
21
+ handler = FTPHandler
22
+ handler .authorizer = authorizer
23
+
24
+ # Define a customized banner (string returned when client connects)
25
+ handler .banner = "pyftpdlib based ftpd ready."
26
+
27
+ # Specify a masquerade address and the range of ports to use for
28
+ # passive connections. Decomment in case you're behind a NAT.
29
+ # handler.masquerade_address = '151.25.42.11'
30
+ # handler.passive_ports = range(60000, 65535)
31
+
32
+ # Instantiate FTP server class and listen on 0.0.0.0:2121
33
+ address = ('' , int (environ ['FTP_PORT' ]))
34
+ server = FTPServer (address , handler )
35
+
36
+ # set a limit for connections
37
+ server .max_cons = 256
38
+ server .max_cons_per_ip = 5
39
+
40
+ # start ftp server
41
+ server .serve_forever ()
42
+
43
+ if __name__ == '__main__' :
44
+ main ()
You can’t perform that action at this time.
0 commit comments