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
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.3.0.tar.gz
(7.3 kB
view details)
Built Distribution
File details
Details for the file sshcon-0.3.0.tar.gz
.
File metadata
- Download URL: sshcon-0.3.0.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63d0f591891e9e2dff0d1cefd2e97a9d545c8321f9ab7a63a112ad24d0ab527a |
|
MD5 | ab49d43d91e57da5b3a5060ba1e596a1 |
|
BLAKE2b-256 | bdbb94b91b1e6a35cd5cbae85cae85882ba6d4db2690cb376859633084edb2dc |
File details
Details for the file sshcon-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: sshcon-0.3.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7821ef3b7a18900a874b55b1aa918760b5831b5feb91029adf3fc4eac5edc63 |
|
MD5 | 586f78a7519a7f915b84bfc028cd19bd |
|
BLAKE2b-256 | 4c86f4e4f8a28e5c935447cfdcfc29ab6589cbbeb8a615ec0eed1ba8b0b8a0ef |