Skip to main content

Userland non-daemon SSH server inheriting current user privileges, with shell, exec, SFTP, and TCP forwarding on POSIX systems.

Project description

Userland non-daemon SSH server that inherits the current user privileges and serves whatever that user can access, with shell, exec, SFTP, and TCP forwarding on POSIX systems.

Novelty

This project is intentionally positioned between telnetd-style ad hoc sharing and a full system sshd deployment.

What is novel here is the combination of:

  • userland operation with no system daemon setup
  • current-user privilege inheritance instead of a separate service account model
  • quick startup for temporary ad hoc sharing
  • one small foreground server process
  • shell, exec, SFTP, local forwarding, and reverse forwarding together
  • real SSH transport and host keys instead of telnet

In other words, this is not trying to replace a hardened multi-user OpenSSH installation. It is trying to provide a quick, dirty, but still encrypted SSH sharing tool for scenarios where telnetd would historically have been used.

Installation

pip install sshshare

Usage

Start the server:

ssh-keygen -t ed25519 -f host_ed25519
sshserve --username alice --password secret --host 127.0.0.1 --port 2222 --host-key host_ed25519

Connect from another terminal with SFTP:

sftp -P 2222 alice@127.0.0.1

Open an interactive shell over SSH:

ssh -p 2222 alice@127.0.0.1

Run a remote command:

ssh -p 2222 alice@127.0.0.1 'pwd && ls'

Use local port forwarding through the server:

ssh -L 8080:127.0.0.1:80 -p 2222 alice@127.0.0.1

Use remote port forwarding through the server:

ssh -R 9090:127.0.0.1:90 -p 2222 alice@127.0.0.1

Use a passphrase-protected Ed25519 host key:

ssh-keygen -t ed25519 -f host_ed25519
sshserve --username alice --password secret --host 127.0.0.1 --port 2222 --host-key host_ed25519 --host-key-passphrase your-passphrase

Notes:

  • The SFTP root is the real filesystem root /.
  • Accessible files and directories are whatever the current OS user running sshserve can access.
  • Shell sessions and exec commands inherit the current user privileges.
  • Shell sessions and exec commands start in the current working directory of the sshserve process.
  • Password authentication is supported and --username / --password are required.
  • PTY shell access is supported on POSIX systems.
  • Direct TCP forwarding and reverse TCP forwarding are supported.
  • --host-key is required and must point to an Ed25519 private key file.
  • This implementation is POSIX-only because process launching uses ctypes-unicode-proclaunch and PTY handling uses POSIX APIs.

Contributing

Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.

License

This project is licensed under the MIT License.

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

sshserve-0.1.0a2.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

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

sshserve-0.1.0a2-py2.py3-none-any.whl (10.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file sshserve-0.1.0a2.tar.gz.

File metadata

  • Download URL: sshserve-0.1.0a2.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for sshserve-0.1.0a2.tar.gz
Algorithm Hash digest
SHA256 04d0546d7d06648b49b10ec8c3453e26a944d15337cc05e8d417b9f9c1e443a5
MD5 f01ff96ed60018d485b8007a6bd005ea
BLAKE2b-256 5a27240ba8888b22e4469a6ede1d88186989140b4212ee31919ed672664ac1ac

See more details on using hashes here.

File details

Details for the file sshserve-0.1.0a2-py2.py3-none-any.whl.

File metadata

  • Download URL: sshserve-0.1.0a2-py2.py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for sshserve-0.1.0a2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9e80d149a48cd341d4e7db947550f9a5f89cdd8ba6c45bc79fb7e82dde9d9e5b
MD5 1335188bea6c2620034d0961efe1a5bd
BLAKE2b-256 a6d1559ec612183644d2fa4a66ec680dc154451605bfeab3c1908ff0c501b2e7

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