Search code examples
pythonsftpdata-science-experience

How do I get SFTP working inside a python Notebook within DSX?


I caught that ftplib is available on DSX IBM Datascience Experience

from ftplib import FTP

Bu how does a SFTP connection look inside a python Notebook? So that I can import local data automatically. TIA


Solution

  • The FTP protocol has nothing to do with SFTP. The sftp program is a client for the SSH protocol that behaves like an ftp program for the FTP protocol. In other words, an FTP client library will not help you to connect to an SSH server.

    At the moment, there are at least two SFTP client libraries on Python, pysftp and sftp-client. There's also an older question here on SO, from a time where SFTP clients were not as readily available. Maybe one of those libraries serves your needs. If it isn't pre-installed on DSX, you can install it from a Python notebook by running !pip install --user <packagename>.