title: Connecting FTP server using ftplib in python
body: <p>i am trying to connect to an ftp server from a VM using ftplib in python to download a file. All ports are open between the VM and the target ftp server.</p>
  
  <p>But i am receiving the below error while the script executes.</p>
  
  <p>Error message: <strong>ftplib.error_temp: 425 Unable to build data connection: Operation not permitted</strong></p>
  
  <p>Could someone help me out here. Thanks In Advance!</p>
  
  <p>The code i am using:</p>
  
  <pre><code>import ftplib 
  from ftplib import FTP
  from datetime import datetime
  import ssl
  
  ftps = ftplib.FTP_TLS()
  
  
  print (ftps.connect('40.71.*.*',*****))
  print(ftps.login('username','password'))
  
  
  ftps.prot_p()
  cdir=ftps.pwd()
  print(cdir)
  x=ftps.cwd('/SAP/KERNEL/LINUX/')
  print(x)
  cdir=ftps.pwd()
  print(cdir)
  ftps.retrbinary("RETR " + "abc.sar" ,open("C:/Users/test/Documents/" + "abc.sar", 'wb').write)
  ftps.close()
  </code></pre>