> ## Content Index
> Fetch the complete content index at: https://www.bagz.fr/llms.txt
> Use this file to discover other available public pages before exploring further.

# Use FTPS (SSL/TLS) with Python 2.6
- URL: https://www.bagz.fr/use-ftps-ssltls-with-python-2-6/
- Published: 2014-10-07T09:17:56.000Z
- Updated: 2014-10-07T09:17:56.000Z
- Author: bgazui
- Tags: Python, #Migrated-1790668826633, #wp, #wp-post, #Import 2026-09-29 08:00

By default, Python 2.6 does not permit to open an FTPS connection (using SSL/TLS) and restricts the use of non secure protocol FTP.

However, it's possible to get around this lack by using the FTP library available since version 2.7, which is fully compatible and supported with 2.6.

You can get the library directly from official sources or through the link below:  
<http://www.bggofurther.com/wp-content/uploads/2014/10/ftplib.zip>

Once the library copied (you can either replace the existing library or integrate it locally), you can so open an FTPS connection by using the FTP\_TLS library. For example:

\>>> from ftplib import FTP\_TLS  
\>>> ftp = FTP\_TLS('ftp.example.org') # connect to host, default port  
\>>> ftp.login() # login anonymously before securing control channel  
'230 Guest login ok, access restrictions apply.'  
\>>> ftp.prot\_p() # securing data connection explicitly  
\>>> ftp.cwd('/') # change working directory to the root  
\>>> ftp.retrlines('LIST') # list directory contents  
total 7  
drwxr-xr-x 8 ftpuser ftpgroup 1024 Jan 3 2012 .  
drwxr-xr-x 8 ftpuser ftpgroup 1024 Jan 3 2012 ..  
drwxr-xr-x 2 ftpuser ftpgroup 1024 Oct 7 2013 bin  
d-wxrwxr-x 2 ftpuser ftpgroup 1024 Sep 17 2013 etc  
drwxr-xr-x 2 ftpuser ftpgroup 1024 Nov 23 2013 lib  
drwxr-xr-x 3 ftpuser ftpgroup 1024 Oct 7 2013 usr  
\-rw-r--r-- 1 ftpuser ftpgroup 312 Aug 18 2013 \_\_init\_\_.py  
'226 Transfer complete.'  
\>>> ftp.quit()  
'221 Goodbye.'  

You can so maintain your applications running with Python 2.6 and use a secure connection for FTP!