-1

My goal is to have a basic FTP program written in Python. First, I need to gain more knowledge. My question is, how can I connect to an Ubuntu Server (hosted via VirtualBox) using Python?

I have tried using the page on the official Python website but I get an error saying socket.error: [Errno 61] Connection refused when using this

from ftplib import FTP
ftp = FTP('jordan@10.0.0.12')

This is the output I get when using ftp - FTP('10.0.0.12')

Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ftplib.py", line 120, in init self.connect(host) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ftplib.py", line 135, in connect self.sock = socket.create_connection((self.host, self.port), self.timeout) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 575, in create_connection raise err socket.error: [Errno 61] Connection refused

I can use an FTP program such as Transmit (the same port and on SFTP) on the same machine and it works fine.

McNets
  • 10,352
  • 3
  • 32
  • 61
Jordan Baron
  • 25
  • 1
  • 1
  • 9

2 Answers2

0

Python's ftplib does not support SFTP, so using PySFTP would work.

Jordan Baron
  • 25
  • 1
  • 1
  • 9
0

An alternative is using paramiko.

Ishwor Bhatta
  • 139
  • 1
  • 3
  • 13