Skip to main content

SSH connector for Linux systems

Project description

sshcon ⚡

Python SSH connector for linux systems

Very simple python SSH connector for linux systems based on super fast SSH2 protocol library -> [ssh2-python][https://github.com/ParallelSSH/ssh2-python].

Installation

pip install sshcon

How to use

from sshcon.main import SshCon


hostname = "myserver"
ssh_user = "myuser"
ssh_ke = ".ssh/mykey"
ssh = SshConn(hostname, ssh_user, ssh_key)

# Run command and save output to the variable
ls = ssh.run(["ls", "-latr", path("/mnt"], capture_output=True, check=True).stdout

# Mount directory
ssh.mount(source="storage:/data", "/mnt", force=True, mkdir=True)

# Remove files
ssh.remove("/my/folder/*.tar", force=True)

# Read text
text = ssh.read_text("/folder/text.txt")

# Write text
ssh.write_text("Ahoj", "/folder/text.txt")

# Check if file
if ssh.isfile("/my/file):
    print("It's a file!")

Todo

  • Add readthedocs
  • Update readme

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

sshcon-0.0.7.tar.gz (3.8 kB view details)

Uploaded Source

File details

Details for the file sshcon-0.0.7.tar.gz.

File metadata

  • Download URL: sshcon-0.0.7.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.9

File hashes

Hashes for sshcon-0.0.7.tar.gz
Algorithm Hash digest
SHA256 cf6ec62d1fadb5bb87523275c51420d770ccb5c339091987ad795152edb6338f
MD5 3c7ebd6539c188a0195a6e2a4c2f113d
BLAKE2b-256 b9948733541a3c23b31071e2bc49439d27ab599fa007c9b6b242730c63cd44ea

See more details on using hashes here.

Supported by

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