0

I use this code and it works perfectly in my local network but I need to connect from a different network to my FTP server.

I already tried run code with this " address = ('81.98.39.196', 2121) " but it doesn't help.

I will very much appreciate every help, thanks!

import os

from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer

def main():
# Instantiate a dummy authorizer for managing 'virtual' users
authorizer = DummyAuthorizer()

# Define a new user having full r/w permissions and a read-only
# anonymous user
authorizer.add_user('user', '12345', '.', perm='elradfmwMT')
# authorizer.add_anonymous(os.getcwd())

# Instantiate FTP handler class
handler = FTPHandler
handler.authorizer = authorizer

# Define a customized banner (string returned when client connects)
handler.banner = "pyftpdlib based ftpd ready."

# Specify a masquerade address and the range of ports to use for
# passive connections.  Decomment in case you're behind a NAT.
# handler.masquerade_address = '151.25.42.11',
# handler.passive_ports = range(60000, 65535)

# Instantiate FTP server class and listen on 0.0.0.0:2121
address = ('192.168.0.229', 2121)
server = FTPServer(address, handler)

# start ftp server
server.serve_forever()

if name == 'main': main() enter code here

William Humphreys
  • 1,206
  • 1
  • 14
  • 38
Vadim
  • 3
  • 2

0 Answers0