sshd-lite

command module
v1.46.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 6 Imported by: 0

README

sshd-lite

GoDoc CI

A feature-light Secure Shell Daemon sshd(8) written in Go (Golang). A slightly more practical version of the SSH daemon described in this blog post http://blog.gopheracademy.com/go-and-ssh/.

Install

Binaries

See the latest release

One-line download and install

curl https://i.jpillora.com/sshd-lite! | bash

Source

go install github.com/jpillora/sshd-lite@latest
Features
  • Cross platform binaries with no dependencies
  • Remote shells (bash in linux/mac and powershell in windows)
  • Authentication (user:pass, ~/.ssh/authorized_keys, github.com/foobar, or none)
  • Seed server-key generation
  • Enable SFTP support with --sftp (allows scp and other SFTP clients)
  • Enable TCP forwarding with --tcp-forwarding (both local and reverse forwarding)
Quick use

Server

$ curl https://i.jpillora.com/sshd-lite! | sh
Downloading: sshd-lite_1.1.0_darwin_amd64
######################################### 100.0%
$ sshd-lite john:doe
2020/12/09 23:55:08 Key from system rng
2020/12/09 23:55:08 RSA key fingerprint is SHA256:kLK6RD2tCqSfvYxdMPa3YRNwUJS09njfE1hXoqOYXG4.
2020/12/09 23:55:08 Authentication enabled (user 'john')
2020/12/09 23:55:08 Listening on 0.0.0.0:2200...

Client

$ ssh john@localhost -p 2200
The authenticity of host '[localhost]:2200 ([::1]:2200)' can't be established.
RSA key fingerprint is SHA256:kLK6RD2tCqSfvYxdMPa3YRNwUJS09njfE1hXoqOYXG4.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes # note fingerprint matches
john@localhost's password: *** # enter password from above
bash-3.2$ date
Wed  9 Dec 2020 23:57:22 AEDT
Usage
$ sshd-lite --help
$ sshd-lite --help

  Usage: sshd-lite [options] <auth>

  <auth> must be set to one of:
  1. a username and password string separated by a colon ("myuser:mypass")
  2. a path to an ssh authorized keys file ("~/.ssh/authorized_keys")
  3. an authorized github user ("github.com/myuser") public keys from .keys
  4. "none" to disable client authentication :WARNING: very insecure

  Notes:
  * if no keyfile and no keyseed are set, a random RSA2048 key is used
  * authorized_key files are automatically reloaded on change
  * once authenticated, clients will have access to a shell of the
    current user. sshd-lite does not lookup system users.
  * sshd-lite only supports remotes shells, sftp, and tcp forwarding. command
    execution are not currently supported.
  * sftp working directory is the home directory of the user

  Options:
  --host, -h            listening interface (defaults to all, default 0.0.0.0)
  --port, -p            listening port (defaults to 22 then fallsback to 2200)
  --shell               the shell to use for remote sessions (default bash/powershell, env SHELL)
  --keyfile, -k         a filepath to a private key (for example an 'id_rsa' file)
  --keyseed             a string to use to seed key generation
  --keyseed-ec          use elliptic curve for key generation
  --keepalive           server keep alive interval seconds (0 to disable, default 60)
  --noenv, -n           ignore environment variables provided by the client
  --verbose, -v         verbose logs
  --quiet, -q           no logs
  --sftp, -s            enable the SFTP subsystem (disabled by default)
  --tcp-forwarding, -t  enable TCP forwarding (both local and reverse; disabled by default)
  --version             display version
  --help                display help

  Version:
    X.Y.Z

  Read more:
    github.com/jpillora/sshd-lite

Programmatic Usage

GoDoc

MIT License

Copyright © 2026 Jaime Pillora <dev@jpillora.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package sshd provides type aliases for the sshd package.
Package sshd provides type aliases for the sshd package.
key
sshtest
Package sshtest provides an AI-friendly test harness for SSH servers and clients.
Package sshtest provides an AI-friendly test harness for SSH servers and clients.
sshtest/log
Package log provides slog capture utilities for testing.
Package log provides slog capture utilities for testing.
sshtest/scenario
Package scenario provides data types and YAML parsing for SSH test scenarios.
Package scenario provides data types and YAML parsing for SSH test scenarios.
winpty module
Package xssh provides a symmetric SSH connection handler that works for both server and client connections.
Package xssh provides a symmetric SSH connection handler that works for both server and client connections.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL