title: ftplib.error_perm: 550 Create directory operation failed while using FTP_TLS
body: <p>I am trying to connect to a secure FTP server created based on this <a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-vsftpd-for-a-user-s-directory-on-ubuntu-16-04" rel="nofollow noreferrer">link</a>. I have not followed step 8 in the link. I am able to establish the connection and also change and print directories but am unable to create new directories. I am also unable to fetch files list.</p>
  
  <p>Here is my code snippet:</p>
  
  <pre><code>import ssl
  from ftplib import FTP_TLS
  import sys
  import os
  import os.path
  
  
  def connect():
      ftp = FTP_TLS()
      ftp.debugging = 2
      ftp.connect('ipaddress', 21)
      ftp.set_pasv(False)
      ftp.login('user', 'passwd')
      return ftp
  
  
  ftps = connect()
  destdir = "/"
  try:
      resp = ftps.pwd()
      ftps.cwd(destdir)
  except Exception:
      ftps.mkd(destdir)
      print(resp)
  root = 'C:\\Users\\****\\****\\Logs'  # local dir
  
  
  for (dir, _, files) in os.walk(root):
      newdir = destdir+dir[len(root):len(dir)].replace("\\", "/")
      print(newdir)
      try:
          ftps.cwd(newdir)
      except Exception:
          ftps.mkd(newdir)
  </code></pre>
  
  <p>I am using python 3.7.3 and the corresponding ftplib. I would be happy to provide any other details required.</p>
  
  <p>PS: I am able to connect with Filezilla and create directories.</p>
  
  <p>This is the error after running.</p>
  
  <p><a href="https://i.stack.imgur.com/IQag2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IQag2.png" alt="Output Error!"></a></p>
  
  <p>I am able to create the directories successfully once I change the dir to /logs. I am getting an error "ftplib.error_perm: 500 Illegal PORT command." whenever I send cmd like retrlines or storbinary
  , I get this <a href="https://drive.google.com/file/d/1lSN32xltm-0pxR05-btuRY1LzdNPInns/view?usp=sharing" rel="nofollow noreferrer">error</a>
  I have searched about this and people have asked to set it to pasv mode. When I do that, I get this <a href="https://drive.google.com/file/d/1SrAyaSYLRCfEzIeaRSgu83K2AilVzYRE/view?usp=sharing" rel="nofollow noreferrer">error</a>. FYI, I have enabled pasv mode in the config file
  I tried changing the port number to a number between pasv ports enabled in the config file (between 30000-31000). It does not connect also in this case. Error returned "ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it"
  I am working the first time with an FTP server or for that matter any server communications, so my problems might seem trivial. I am sorry for your trouble. 
  Thanks.</p>