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.0a1.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.0a1-py2.py3-none-any.whl (10.1 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

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

File hashes

Hashes for sshserve-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 22a77a531d14bd9eb050eb2b5e0fc4f3b00c3a20af950f950930d0a4388fe040
MD5 c89062e713aa190bf05ae2a325e8c6e1
BLAKE2b-256 47b392cc92865ac33a83d6671cc53e8d7562b3f8c956b4e15275a85bbb04878c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sshserve-0.1.0a1-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.12

File hashes

Hashes for sshserve-0.1.0a1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4c40738abe08b0d113e9b892ede0be642a66bfe62e02b585830528c58926872b
MD5 0fd13bad77e4871455498a77c63ac7f9
BLAKE2b-256 50b089d52027a6325f7714e75d600f12c998b080dc077c6c98112afa20319e71

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