SkillAgentSearch skills...

Lssh

lssh: A list-based SSH/SCP/SFTP client supporting single and parallel connections, local bashrc usage on remote machines, and advanced proxying. Written in Go.

Install / Use

/learn @blacknon/Lssh
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Go Report Card

lssh

TUI list select ssh/scp/sftp client tools.

Description

This command utility to read a prepared list in advance and connect ssh/scp/sftp the selected host. List file is set in yaml format. When selecting a host, you can filter by keywords. Can execute commands concurrently to multiple hosts.

lsftp shells can be connected in parallel.

Supported multiple ssh proxy, http/socks5 proxy, x11 forward, and port forwarding.

Features

  • List selection type Pure Go ssh client.
  • It can run on Linux, macOS and Windows.
  • Commands can be executed by ssh connection in parallel.
  • There is a shell function that connects to multiple hosts in parallel for interactive operation and connects with local commands via pipes.
  • Supported multiple proxy, ssh, http, and socks5 proxy. It's supported multi-stage proxy.
  • Supported ssh-agent.
  • Supported Local and Remote Port forward, Dynamic Forward(SOCKS5, http), Reverse Dynamic Forward(SOCKS5, http) and x11 forward.
  • Supported KnownHosts.
  • By using NFS Forward/NFS Reverse Forward, the NFS server starts listening to the PATH of the local host or remote machine, making it available via local port forwarding.
  • Can use bashrc of local machine at ssh connection destination.
  • It supports various authentication methods. Password, Public key, Certificate and PKCS11(Yubikey etc.).
  • Can read the OpenSSH config (~/.ssh/config) and use it as it is.

Demo

<p align="center"> <img src="./images/lssh_linux.gif" /> </p>

Install

compile

compile gofile(tested go1.22.5).

GO111MODULE=auto go get -u github.com/blacknon/lssh/cmd/lssh
GO111MODULE=auto go get -u github.com/blacknon/lssh/cmd/lscp
GO111MODULE=auto go get -u github.com/blacknon/lssh/cmd/lsftp

# copy sample config. create `~/.lssh.conf`.
test -f ~/.lssh.conf||curl -s https://raw.githubusercontent.com/blacknon/lssh/master/example/config.tml -o ~/.lssh.conf

or

git clone https://github.com/blacknon/lssh
cd lssh
GO111MODULE=auto make && sudo make install

# copy sample config. create `~/.lssh.conf`.
test -f ~/.lssh.conf||curl -s https://raw.githubusercontent.com/blacknon/lssh/master/example/config.tml -o ~/.lssh.conf

brew install

brew install(Mac OS X)

brew tap blacknon/lssh
brew install lssh

# copy sample config. create `~/.lssh.conf`.
test -f ~/.lssh.conf||curl -s https://raw.githubusercontent.com/blacknon/lssh/master/example/config.tml -o ~/.lssh.conf

Config

Please edit "~/.lssh.conf".
For details see wiki.

Usage

lssh

run command.

lssh

option(lssh)

NAME:
    lssh - TUI list select and parallel ssh client command.
USAGE:
    lssh [options] [commands...]

OPTIONS:
    --host servername, -H servername            connect servername.
    --file filepath, -F filepath                config filepath. (default: "/Users/blacknon/.lssh.conf")
    -L [bind_address:]port:remote_address:port  Local port forward mode.Specify a [bind_address:]port:remote_address:port. Only single connection works.
    -R [bind_address:]port:remote_address:port  Remote port forward mode.Specify a [bind_address:]port:remote_address:port. If only one port is specified, it will operate as Reverse Dynamic Forward. Only single connection works.
    -D port                                     Dynamic port forward mode(Socks5). Specify a port. Only single connection works.
    -d port                                     HTTP Dynamic port forward mode. Specify a port. Only single connection works.
    -r port                                     HTTP Reverse Dynamic port forward mode. Specify a port. Only single connection works.
    -M port:/path/to/remote                     NFS Dynamic forward mode. Specify a port:/path/to/remote. Only single connection works.
    -m port:/path/to/local                      NFS Reverse Dynamic forward mode. Specify a port:/path/to/local. Only single connection works.
    -w                                          Displays the server header when in command execution mode.
    -W                                          Not displays the server header when in command execution mode.
    --not-execute, -N                           not execute remote command and shell.
    --X11, -X                                   Enable x11 forwarding(forward to ${DISPLAY}).
    -Y                                          Enable trusted x11 forwarding(forward to ${DISPLAY}).
    --term, -t                                  run specified command at terminal.
    --parallel, -p                              run command parallel node(tail -F etc...).
    --localrc                                   use local bashrc shell.
    --not-localrc                               not use local bashrc shell.
    --list, -l                                  print server list from config.
    --help, -h                                  print this help
    --version, -v                               print the version

COPYRIGHT:
    blacknon(blacknon@orebibou.com)

VERSION:
    0.6.12

USAGE:
    # connect ssh
    lssh

    # run command selected server over ssh.
    lssh command...

    # run command parallel in selected server over ssh.
    lssh -p command...

lscpd

run command.

lscp from... to

option(lscp)

NAME:
    lscp - TUI list select and parallel scp client command.
USAGE:
    lscp [options] (local|remote):from_path... (local|remote):to_path

OPTIONS:
    --host value, -H value  connect servernames
    --list, -l              print server list from config
    --file value, -F value  config file path (default: "/Users/blacknon/.lssh.conf")
    --permission, -p        copy file permission
    --help, -h              print this help
    --version, -v           print the version

COPYRIGHT:
    blacknon(blacknon@orebibou.com)

VERSION:
    0.6.12

USAGE:
    # local to remote scp
    lscp /path/to/local... remote:/path/to/remote

    # remote to local scp
    lscp remote:/path/to/remote... /path/to/local

    # remote to remote scp
    lscp remote:/path/to/remote... remote:/path/to/local

lsftp

run command.

lsftp

option(lsftp)

NAME:
    lsftp - TUI list select and parallel sftp client command.
USAGE:
    lsftp [options]

OPTIONS:
    --file value, -F value  config file path (default: "/Users/blacknon/.lssh.conf")
    --help, -h              print this help
    --version, -v           print the version

COPYRIGHT:
    blacknon(blacknon@orebibou.com)

VERSION:
    0.6.12

USAGE:
    # start lsftp shell
    lsftp

If you specify a command as an argument, you can select multiple hosts. Select host <kbd>Tab</kbd>, select all displayed hosts <kbd>Ctrl</kbd> + <kbd>a</kbd>.

1. [lssh] connect terminal

<details>

You can connect to the terminal like a normal ssh command (OpenSSH).

<p align="center"> <img src="./images/1-1.gif" /> </p>

You can connect using a local bashrc file (if ssh login shell is bash).

<p align="center"> <img src="./images/1-2.gif" /> </p>

~/.lssh.conf example.

[server.localrc]
addr = "192.168.100.104"
key  = "/path/to/private_key"
note = "Use local bashrc files."
local_rc = 'yes'
local_rc_compress = true # gzip compress localrc file data
local_rc_file = [
     "~/dotfiles/.bashrc"
    ,"~/dotfiles/bash_prompt"
    ,"~/dotfiles/sh_alias"
    ,"~/dotfiles/sh_export"
    ,"~/dotfiles/sh_function"
]

You can execute commands before and after ssh connection.
You can also change the color of each host's terminal by combining it with the OSC escape sequence.

if iTerm2, you can also change the profile.

<p align="center"> <img src="./images/1-3.gif" /> </p>

~/.lssh.conf example.

[server.iTerm2_sample]
addr = "192.168.100.103"
key  = "/path/to/private_key"
note = "Before/After run local command"
pre_cmd = 'printf "\033]50;SetProfile=Theme\a"'    # ssh theme
post_cmd = 'printf "\033]50;SetProfile=Default\a"' # local theme
note = "(option) exec command after ssh disconnected."

[server.GnomeTerminal_sample]
addr = "192.168.100.103"
key  = "/path/to/private_key"
note = "Before/After run local command"
pre_cmd = 'printf "\e]10;#ffffff\a\e]11;#503000\a"'  # ssh color
post_cmd = 'printf "\e]10;#ffffff\a\e]11;#000000\a"' # local color
note = "(option) exec command after ssh disconnected."

A terminal log can be recorded by writing a configuration file.

~/.lssh.conf example.

[log]
enable = true
timestamp = true
dirpath = "~/log/lssh/<Date>/<Hostname>"

There are other parameters corresponding to ClientAliveInterval and ClientAliveCountMax.

[server.alivecount]
addr = "192.168.100.101"
key  = "/path/to/private_key"
note = "alive count max."
alive_max = 3 # ServerAliveCountMax
alive_interval = 60 # ServerAliveCountInterval
</details>

2. [lssh] run command (with parallel)

<details>

It is possible to execute by specifying command in argument.
Parallel execution can be performed by adding the -p option.

<p align="center"> <img src="./images/2-1.gif" /> </p>
# exec command over ssh.
lssh <command...>

# exec command over ssh, parallel.
lssh -p <command>

In parallel connection mode (-p option), Stdin can be sent to each host.\

<p align="center"> <img src="./images/2-2.gif" /> </p>

Can be piped to send Stdin.

<p align="center"> <img src="./images/2-3.gif" /> </p>
# You can pass values ​​in a pipe
command... | lssh <command...>
</details>

3. [lscp] scp (local=>remote(multi), remote(multi)=>local, remote=>remote(multi))

<details>

You can do scp by selecting a list with the command lscp.
You can select multiple connection destinations. This program use sftp protocol.

<p align="center"> <img src="./images/4-1.gif"
View on GitHub
GitHub Stars293
CategoryCustomer
Updated7d ago
Forks29

Languages

Go

Security Score

100/100

Audited on Mar 21, 2026

No findings