Skip to main content

SSH Kernel

Project description

SSH Kernel

SSH Kernel is a Jupyter kernel specialized in executing commands remotely with paramiko SSH client.

Major requirements

  • Python3.5+
  • IPython 7.0+

Recommended system requirements

Host OS (running notebook server):

  • Ubuntu 18.04+
  • Windows 10 WSL (Ubuntu 18.04+)

Target OS (running sshd):

  • Ubuntu16.04+
  • CentOS6+

Installation

Please adopt installation option depends on your Python environment.

pip install -U sshkernel
python -m sshkernel install [--user|--sys-prefix]
# `python -m sshkernel install --help` for more information.

Verify that sshkernel is installed correctly by listing available Jupyter kernel specs:

$ jupyter kernelspec list
Available kernels:
  python3        /tmp/env/share/jupyter/kernels/python3
  ssh            /tmp/env/share/jupyter/kernels/ssh  # <--

  (Path differs depends on environment)

To upgrade:

pip install --upgrade sshkernel

To uninstall:

jupyter kernelspec remove ssh
pip uninstall sshkernel

Notes about python environment

The latest version of this library is mainly developed with Python 3.7.3 installed with pyenv.

CI is performed with Python3.6 and 3.7 on Debian based container without conda, and manual test is performed with Ubuntu based container with conda, which derived from official Jupyter Notebook stack. Anaconda on Windows 10 is also confirmed, but is less tested in our development/production.

Getting Started

Basic examples of using SSH Kernel:

Configuration

SSH Kernel obtains configuration data from ~/.ssh/config file to connect servers.

Possible keywords are as follows:

  • HostName
  • User
  • Port
  • IdentityFile
  • ForwardAgent

Notes about private keys

  • As private key files in ~/.ssh/ are discoverable, you do not necessarily specify IdentityFile
  • If you use a ed25519 key, please generate with or convert into old PEM format
    • e.g. ssh-keygen -m PEM -t ed25519 ...
    • This is because paramiko library doesn't support latest format "RFC4716"

Configuration examples

Example1:

[~/.ssh/config]
Host myserver
  HostName myserver.example.com
  User admin
  Port 2222
  IdentityFile ~/.ssh/id_rsa_myserver
  ForwardAgent yes

Host *
  User ubuntu

Example2:

[~/.ssh/config]
Host another-server
  HostName 192.0.2.1

Minimal example:

[~/.ssh/config]

# If you specify a FQDN / IP address, same login user, and discoverable private key,
# no configuration needed

See also a tutorial above in detail.

Parameterized run

See examples/parameterized-notebook.

Limitations

  • As Jupyter Notebook has limitation to handle stdin, you may need to change some server configuration and commands to avoid interactive input.
    • e.g. use publickey-authentication instead of password, enable NOPASSWD for sudo, use expect
  • Some shell variables are different from normal interactive shell
    • e.g. $?, $$

LICENSE

This software is released under the terms of the Modified BSD License.

Logo from Wikimedia Commons is licensed under CC BY 3.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sshkernel-0.11.1.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sshkernel-0.11.1-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file sshkernel-0.11.1.tar.gz.

File metadata

  • Download URL: sshkernel-0.11.1.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12

File hashes

Hashes for sshkernel-0.11.1.tar.gz
Algorithm Hash digest
SHA256 219598dbaace83c68bc8d9aac57cbc17c239940757c805d782accb0fea68de54
MD5 b4ebe73799847f0c253f5de5b051c7f5
BLAKE2b-256 799889f2a49603144455d05b95a6b173b66aa49019dcb3ce0cfb67bfc432a7fc

See more details on using hashes here.

File details

Details for the file sshkernel-0.11.1-py3-none-any.whl.

File metadata

  • Download URL: sshkernel-0.11.1-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12

File hashes

Hashes for sshkernel-0.11.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2659ab387e27a0d321248f34515bc7d7012e0454d3f1c7f0aee5006ddf952916
MD5 1ab002dbbdf51cae2e8f5a236ecc3e19
BLAKE2b-256 db007510ac3d74b127c78dd7dda2b9132c3f7b0c212b047daf6da946c9301db4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page