Path: csiph.com!usenet.pasdenom.info!news.franciliens.net!news.muarf.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; '21,': 0.07; 'file)': 0.09; 'works.': 0.09; 'cc:addr:python-list': 0.11; 'random': 0.14; 'file.close()': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'ftplib': 0.16; 'port,': 0.16; 'range.': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'trying': 0.19; 'seems': 0.21; 'import': 0.22; 'cc:addr:python.org': 0.22; 'instance,': 0.24; 'script.': 0.24; '(or': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'firewall': 0.31; 'helpful.': 0.31; 'file': 0.32; 'open': 0.33; 'running': 0.33; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'skip:f 40': 0.36; 'two': 0.37; 'skip:o 20': 0.38; 'server': 0.38; 'configured': 0.38; 'pm,': 0.38; 'such': 0.63; 'our': 0.64; 'here': 0.66; 'default': 0.69; 'ports.': 0.84; 'subject:skip:F 10': 0.84; 'destination': 0.91; 'to:none': 0.92; 'ports': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=8LOHOlY2zN9/g9Xqa0HHL14fZCG4HtFWUsyxdcCNW2A=; b=jsf56f6XCwlxR5XyAmuNHpMbnCFkrgVNoPOvK1AYXhJ67RysmKM8GlL8fR0p+z4ldI cpLc95jS1J0TSsT520tkYI0tqmWA1PeNLb3LDK03CgvHQZLR0pWVn6MxkXlhiUj1Nwib H+ikbBJ1IT/kWDSw4KyHjXRvtJpyg8oY4foPTjz5gUifz/N+Ce5gYhdY8FPflRpkBZ3t GQv+LBFMCUPjC3Hhlx905LaAh9LX00Jyuh/l4yp8fY/KPfb+DOTPxlwVHUrWf65O+5gf OsprHiysf3X8iGmpkARPT84/ekd/V1yoiRb4SqSw4fLIpS2RSaVKb4cwtd9V0gBqLNp+ FEwg== MIME-Version: 1.0 X-Received: by 10.50.79.135 with SMTP id j7mr6044572igx.14.1418185085274; Tue, 09 Dec 2014 20:18:05 -0800 (PST) In-Reply-To: References: Date: Wed, 10 Dec 2014 15:18:05 +1100 Subject: Re: Ftplib.FTP_TLS Ports From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1418185094 news.xs4all.nl 2925 [2001:888:2000:d::a6]:46905 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:82256 On Wed, Dec 10, 2014 at 3:13 PM, Eric wrote: > We are trying to open our firewall but it keeps failing. The docs state > that the default port is 21 and we've opened port 21. I've ran tcpdump on > the box while running the script. I see a destination port of 21, but there > seems to be random destination ports such as 2320 which follow. If we open > the firewall to allow all traffic, the script works. Here is a snip of what > I have for the ftp portion. Any ideas would be helpful. > > import ftplib > > session = ftplib.FTP_TLS('xxx.ftp.com','user','password') > file = open('Bkup.tar.gz','rb') > session.storbinary('STOR Bkup.tar.gz', file) > file.close() > session.quit() FTP works with two (or more) connections: one on the control port, and one (or more) on data ports. You'd have to check out what the server is using for data ports, and then open that range. For instance, it might be configured to use 2300-2350 for data ports, in which case you could permit all of those ports. ChrisA