Skip to main content

SSH connector for Linux systems

Project description

sshcon ⚡

Python SSH connector for linux systems

Python SSH connector for linux systems based on super fast SSH2 protocol library -> ssh2-python.

Installation

pip install sshcon

How to use

Make sure you check readthedocs!

from sshcon.main import SshCon


hostname = "myserver"
ssh_user = "myuser"
ssh_key = "/home/user/.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("Hey!", "/folder/text.txt")

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

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.3.3.tar.gz (7.4 kB view hashes)

Uploaded Source

Built Distribution

sshcon-0.3.3-py3-none-any.whl (6.9 kB view hashes)

Uploaded Python 3

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