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
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
Release history Release notifications | RSS feed
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.2.0.tar.gz
(6.3 kB
view details)
File details
Details for the file sshcon-0.2.0.tar.gz
.
File metadata
- Download URL: sshcon-0.2.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bb064387496548415f0759acd532012c0169854999e5a81bea86ab00a679415 |
|
MD5 | c4c776b612b3b5808640268d01788557 |
|
BLAKE2b-256 | 85e5a53838c4f0500ee5bc4a46a460dca32ef6d0d91972896b7e91d8d647a937 |