Giter VIP home page Giter VIP logo

sshs's Introduction

sshs

Packaging status

Terminal user interface for SSH.
It uses ~/.ssh/config to list and connect to hosts.



example

Requirements

You need to have ssh installed and accessible from your terminal.

How to install

Homebrew

brew install sshs

Chocolatey

Thanks to Jakub Levý for maintaining this package on Chocolatey.

choco install sshs

Arch Linux

Pacman

Vote for the package to be added to the official repository.
In the meantime you can manually install it by cloning the repository and running makepkg:

pacman -S --needed git base-devel
git clone https://aur.archlinux.org/sshs.git
cd sshs
makepkg -si

Yay

yay -Syua --needed --noconfirm sshs

NixOS / Nix

As a Flake

nix profile install 'github:quantumsheep/sshs'

In your NixOS configuration

environment.systemPackages = with pkgs; [ sshs ];

In your Home Manager configuration

home.packages = with pkgs; [ sshs ];

From releases

Releases contains prebuilt binaries for Linux, macOS and Windows. You can download them at https://github.com/quantumsheep/sshs/releases.

From sources

Building sshs from sources requires Rust compiler and Cargo to be installed. You can install them with rustup.

cargo install --git https://github.com/quantumsheep/sshs

Be sure to have ~/.cargo/bin in your PATH environment variable.

You can also clone the repository and build it manually:

git clone https://github.com/quantumsheep/sshs.git
cd sshs
cargo build --release

The binary will be located at ./target/release/sshs once the build is complete.

Troubleshooting

[...]/.ssh/config: no such file or directory

  • Check if you have ~/.ssh/config file
  • If you don't, you can create it with touch ~/.ssh/config

If you want to use another SSH config file, you can use the --config option.

Here's a sample ~/.ssh/config file:

Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_rsa

Host "My server"
  HostName server1.example.com
  User root
  Port 22

Host "Go through Proxy"
  HostName server2.example.com
  User someone
  Port 22
  ProxyCommand ssh -W %h:%p proxy.example.com

You can check the OpenBSD ssh_config reference for more information on how to setup ~/.ssh/config.

sshs's People

Contributors

anthony-francisco avatar chenrui333 avatar nodauf avatar penumbra23 avatar quantumsheep avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sshs's Issues

Support for SSH alias

I am using kitty and I would like to use it's own shell integration, so I need to use ssh like: kitty +kitten ssh name@host.

I created alias for this command:

alias ssh="kitty +kitten ssh"

I thought it might work from sshs, but it's not. Does sshs call ssh command directly from /usr/bin/ssh?

[ISSUE] - Multiple Host Configuration Inheritance not working as expected

Hi all,

First of all, thanks for the tool, it's really helpfull! :)

With the rewrite of the code, it seems that sshs is not parsing the ssh configuration as before and does not work like OpenSSH does.

My file structure looks like this :

.ssh
├── config
└── zones
    ├── infra1
    ├── infra2
    └── cust
        ├── cust1
        └── cust2

With a simple ssh config file that contains Include to other ssh config files located in the `zones' subdirectory. This allow me, like many people, to structure and separate ssh configuration for every different infrastructure.

My ssh zones files looks like this:

Host device01.domain.tld
        Hostname 10.0.0.1

Host device02.domain.tld
        Hostname 10.0.0.2

Host device03.domain.tld
        Hostname 10.0.0.3

Host *.domain.tld
    User bob
    ProxyJump jump01
    IdentityFile ~/path/to/private/key/cust1_id_ed25519

In version 3.4.0, this configuration was handled correctly and all the Host matching block where read by sshs and I was able to connect to device01.domain.tld using the proper user, ssh key, cipher, command and proxy jump.

Since version 4.0.0 and more specifically with 4.1.0, sshs to device01.domain.tld will not read other Host block and will only apply the configuration of the individual Host block. This mean that using sshs to connect to device01.domain.tld will not use bob as user, not use the specified IdentityFile neither the Proxy Jump configuration.

To make it works in version 4.1.0 my ssh zone file need to look like this:

Host device01.domain.tld
    Hostname 10.0.0.1
    User bob
    ProxyJump jump01
    IdentityFile ~/path/to/private/key/cust1_id_ed25519

Host device02.domain.tld
    Hostname 10.0.0.2
    User bob
    ProxyJump jump01
    IdentityFile ~/path/to/private/key/cust1_id_ed25519

Host device03.domain.tld
    Hostname 10.0.0.3
    User bob
    ProxyJump jump01
    IdentityFile ~/path/to/private/key/cust1_id_ed25519

It works, but it makes the configuration heavier and more complex to maintain.

Looks like a bug in the parser as it does not read any other Host blocks.

Thanks for your help :)
Saldru

StrictHostKeyChecking

The application is bothered by this entry in the config that I need to use. Is there anything I can do about it?

2023/12/06 11:36:26 /Users/xxx/.ssh/config:0: config variable before Host variable

StrictHostKeyChecking=no

[BUG] 3.1.0 doesn’t sort host names

goetz@Wintermute ~ % sshs -v
sshs version 3.1.0
(installed via brew on macOS 12.3.1/arm64)

According to the commit history of 3.1.0 this version should sort the hosts by name, but it doesn’t seem to be the case:

grafik

Implement scrolling.

We have more than a hundred host entries.
When we press the down arrow, the selector disappears after the first screen is over.
We would like to have the selector stay in view and move the host list up.

sshs not working from Mintty on Windows 10?

Hello,

I'm working on Windows 10 x64, and use the Git Bash utility for my CLI needs. This utility can use either the classic cmd of Windows, or Mintty. I always use Mintty instead of the classic Windows cmd.

Unfortunately, sshs does not seem to work in Mintty. It works great in Windows cmd (same behavior as the GIF in the readme file), but here is what I see when ran from Mintty (no output and of course no other window is displayed):

image

Does anyone else has the same problem? Is sshs incompatible with Mintty or is this a configuration issue on my part?

Thank you for your help!

panic: runtime error: index out of range [0] with length 0

I am getting the following when I am trying to invoke sshs on Arch Linux:

panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/quantumsheep/sshs/ui.NewHostsTable(0xc00012c1c0, {0xc000018be8, 0x7b6232}, {0x0, 0x0}, 0x0)
	/home/runner/work/sshs/sshs/ui/hosts.go:121 +0x705
github.com/quantumsheep/sshs/cmd.run(0xa81fc0, {0x7a3156, 0x0, 0x0})
	/home/runner/work/sshs/sshs/cmd/root.go:64 +0x2f8
github.com/spf13/cobra.(*Command).execute(0xa81fc0, {0xc000012200, 0x0, 0x0})
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:860 +0x5f8
github.com/spf13/cobra.(*Command).ExecuteC(0xa81fc0)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x3bc
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:902
github.com/quantumsheep/sshs/cmd.Execute()
	/home/runner/work/sshs/sshs/cmd/root.go:100 +0x25
main.main()
	/home/runner/work/sshs/sshs/main.go:8 +0x17

I have tried installing AUR as well as binaries from the releases section. What am I missing?

FeatReq: sorting of entries

A command line option for sshs like --sort would be nice to have, so that similar named entries are next to each other while browsing with the cursor keys.

My .ssh/config has a lot of entries like

GroupNameA-ServerName1
GroupNameA-ServerName2
GroupNameA-ServerName3
GroupNameB-ServerName1

but not necessarily in this order in the config file. I could manually sort it, but …

App crashes if search doesn't match any entry

App version

2.0.0

Environment

Windows 10

Go version

go1.17.7

Issue

After entering some string in the search bar that doesn't match any entry in the hosts file and pressing enter, the app crashes (or at least the result is undefined).

I'll take a better look at the code in a sec, hopefully submit a proper PR in some time.

Btw, thanks for the app! Nice utility for everyday ssh use! 👍

Only the global IdentityFile is used

Since the v4.0.0, I'm not able to connect to my server with different private keys than the global host config.

I was first using a per server config and nothing was connecting, after I defined the "Host *" block with one private key and the servers using that private key were ok.

I'm using SSHS v4.1.1 and SSH v9.5.0.0 on Windows. (previously was on SSH v8.6 and that was the same)

It was working on SSHS v3.4

Thanks

Hostname is truncated if the name contains "["

Hi. Thank you for this awesome and simple tool.

If a Hostname contains a [ character, the last character in the hostname is removed.

image

image

To reproduce, add the below hosts to your config.

Host "Host1 production"
  HostName example.org
  User username

Host "Host2 production]"
  HostName example.org
  User username

Host "Host3 [production]"
  HostName example.org
  User username

Host "Host4 [production"
  HostName example.org
  User username

Reinstallation problem

Hi everyone,

I don't know why, today when i launched "SSHS", i had this error :
2023/01/30 14:37:15 strconv.Atoi: parsing "22\t": invalid syntax

So after some tries, i uninstall sshs application in order to reinstall it with chocolatey and i don't know why, it says me continually that the sshs-windows-386.exe program is using by another process.

image

Can you help me with thoses issues ?

Add description field

First, thanks for this great tool !

The only thing that is missing for my usage is a description field.
It's not always easy to remember which project is on which host.

Example:

  • Hostname = app-web-prd04
  • Description = Owncloud, WordPress

We could search either on the hostname or the description field.

But this field is not available: https://linux.die.net/man/5/ssh_config

Is it possible ? Maybe it would require another config file ?

Unable to launch after splitting ssh config file

sshs was running fine with my initial ssh configuration which looked like this:

Host personal
    Hostname personal.com
    .... other config elements....

Host work
    Hostname work.com
    .... other config elements....

VisualHostKey yes
.... other global flags...

For better management, I split my config into multiple files:

  • ~/.ssh/config
Include personal/config
Include work/config
VisualHostKey yes
  • ~/.ssh/personal/config
Host personal
    Hostname personal.com
    .... other config elements....
  • ~/.ssh/work/config
Host work
    Hostname work.com
    .... other config elements....

Now sshs will fail with error
2023/07/30 02:40:24 /Users/Laptop/.ssh/config:209: config variable before Host variable

and this issue is happening because of anything at place of .... other global flags... regardless of where they exist in config file, in separate file, or order of imports.

Additional Information that might be helpful:
https://github.com/mikkeloscar/sshconfig/blob/main/parser.go#L146
OS: Ventura 13.4.1 on Apple M1 Max.
Shell: kitty 0.29.2
sshs version 3.4.0

How to exit?

I can't exit the sshs utility.
"exit", Cmd+C not working. Only killing the terminal does.

Color fix for terminal with white background

Issue

Can't see on light colour background (there are other lines underneath)
image

SetTextColor(tcell.ColorWhite)

Possible resolution

  • Option 1: Detect the terminal's font colour and match the same
  • Option 2: provide some config option for set of colour templates
  • Option 3: force black background

Support for Include

Thanks for your tool.

It would be really good it can support Include (eg Include conf.d/*) pattern from ~/.ssh/config.

Multiple `Include` in `.ssh/config` not working

Hello!

In 4.0.0, Include blocks was not taken into account.

In 4.0.1, I can have only one Include block in my $HOME/.ssh/config file, if else I have this error:

❯ ./sshs-darwin-arm64
Error: Cannot include hosts inside a host block

Here is an example of my $HOME/.ssh/config

Include ~/shell-configs/.ssh-prod
Include ~/shell-configs/.ssh-noprod

It worked fine in 3.4.0 😄

FeatReq: Host/group folding

My .ssh/config has a lot of entries like

GroupNameA-ServerName1
GroupNameA-ServerName2
GroupNameA-ServerName3
GroupNameB-ServerName1
GroupNameB-ServerName2
GroupNameB-ServerName3

It’d be cool to have an option for sshs like --grouping where all similar named "GroupNameX" are in collapsable folders like:

GroupNameA--Servername1
……………………………-Servername2
……………………………-Servername3
GroupNameB+-[3 entries]

So GroupNameA is uncollapsed here, and GroupNameB collapsed, hiding another 3 entries prefixed with GroupNameB.

See also #21 - may has a weak dependency.

Hostname and Aliases are the same

Hostname and Aliases are the same - the same data are displayed twice. Could it be removed please?

Hostname │ Aliases │ User │ Target │ Port │

sshs version 3.4.0
https://aur.archlinux.org/packages/sshs

ssh -V
OpenSSH_9.1p1, OpenSSL 3.0.7 1 Nov 2022

Thanks

Return to sshs page after logout

Hi,

After an exit on the remote machine, we return to the source machine but without sshs. Is there a way to return directly to the sshs page? An operating mode like screen or tmux to always keep the active process in the foreground?

Work if Host == Hostname

Let this also work if the config looks like this:

Host aur.archlinux.org
  IdentityFile ~/.ssh/foobar
  User foobar

Host example.com
 IdentityFile ~/.ssh/foobar
  User foobar

Maybe with an extra option?

fail with error `config variable before Host variable`

@quantumsheep

This looks pretty useful!

It fails for me on MacOS:

❯ sshs -v
sshs version 1.3.1

❯ sshs
2022/02/04 14:36:43 config variable before Host variable

❯ echo $?
1

My ~/.ssh/config looks something like this:

# ~/.ssh/config

# Jump comes first.
Include ~/.ssh/jump.conf

# Then Group A.
Include ~/.ssh/group_a.conf

# Then Group B.
Include ~/.ssh/group_b.conf

# My own stuff goes here.
Include ~/.ssh/myhosts.conf

# Defaults MUST be LAST.
Include ~/.ssh/defaults.conf
# ~/.ssh/defaults.conf

# Default host * and !<other_host> for exceptions.
host * !github.com !gitlab.com
    # My username
    user redacted

    # Use bastion by default
    Proxycommand ssh redacted@jump -YW %h:%p

    # Default identity
    IdentityFile /Users/redacted/.ssh/id_jump

    # Do not leak identities to the remote host
    IdentitiesOnly yes

    # Use pubkey, not password, by default
    PubkeyAuthentication yes
    PasswordAuthentication no

    # Ask on first connection and remember
    stricthostkeychecking ask

    # Other defaults
    port 22
    TCPkeepalive yes
    ServerAliveInterval 60

    # Uncomment next line on MacOS.
    UseKeychain no

[feature request] alpine

Is sshs currently available or planned to be made available on Alpine Linux? If not, are there any alternative packages or workarounds that can achieve a similar functionality?

sshs seems to be confused with User defined as a parameter for global and host

seen w/ sshs 3.4.0

sshs seems to be confused with User defined as a parameter for global and host

Here is the content of my config file.

Host *
User admin
ServerAliveInterval 30
ServerAliveCountMax 120

Host axis-b8a44f
User root

I'm expected to have the user root used for the connection to axis-b8a44f as it is shown by sshs
image

But it seems that it's not the case, based ion the ssh prompt
admin@axis-b8a44f's password:

Add the ability to ignore certain entries in the config file

If i have a file config with two entries like this :

Host gitlab
  HostName gitlab.com
  IdentityFile ~/.ssh/id_rsa
  User bob

Host server
  HostName server.com
  IdentityFile ~/.ssh/id_rsa
  User bob
    

When i execute sshs i want display only server.
Is this possible ?

I changed the name of an item in my .ssh config, now it will no longer show up?

Hey there.
I am not quite sure what to do about this, but I changed the name of an item in my .ssh config and now it will no longer show up in sshs. I tried specifying --config ~/.ssh/config, just in case, but same result. All the other entries are there, just not the I renamed. I tried changing the name again, etc, but it just won't show up. Is there some sort of cache or something I need to clear out?

Thanks,
-MH

Support for Alias

I have a server that posess multiple alias :

Host server01 server_fonctionnality server@fqdn
        Hostname <IP>
        User <USER>
        Port 22
        IdentityFile ~/.ssh/<KEY>

It seems that sshs try to access to a server named "server01 server_fonctionnality server@fqdn" instead of one of the 3 aliases

Insufficient installation process?

2022/02/22 20:53:25 open C:\Users*****.ssh\config: The system cannot find the specified path.

Appears after "successful" installation on Win 10 Pro 64 bit

Custom Arguments while ssh

Hello @quantumsheep,

I tried this and this project is Awesome. It help me to manage all my Remote Connections and made working on them easy. But I am also using this tool https://github.com/micharbet/CLE to login to remote server, this tool had one benefit as "lssh"


Explaination from Readme:

lssh utility (ssh wrapper)

The CLE is able to pass itself over ssh to a remote system. Use the wrapper called lssh instead of the regular 'ssh' command for a login into a remote account and CLE will be copied over then started seamlessly:


As this tool is coping all my required default configuration over Remote Host. It is easy to work on Remote Server. So I tried to use this with sshs but this wrapper does not work, I tried to set alias lssh=ssh but this also didn't work.

So can you please help me to configure this so when ever I tried to run the sshs then It will also use this lssh wrapper from CLE project.

This will be great help to me..

add optional alias?

I understand sshconfig doesn't have a field for alias. what about a special comment?

Host 10.0.0.1
  # alias: myrouter
  Hostname 10.0.0.1
  Port 22

hostname contains invalid characters

Hi,
Ubuntu 22.04.3 LTS
sshs version 3.4.0

Since few weeks I am getting "hostname contains invalid characters" error when trying connect to hostnames that contain spaces in name. It was working before perfectly.

Launching:
sshs -c ~/sshs_config

non working example:
Host "my Lab"
HostName 192.168.1.2
User root
Port 22

working example:
Host "MyLab"
HostName 192.168.1.3
User root
Port 22

Possible to use `know_hosts` to populate the `/ssh/config` file

Since the known_hosts file includes all the hosts you connect to, it would be nice to somehow use that as the basis to build out the menu. Since know_hosts lacks things that sshs needs, the user would still need to add info, but it would be a solid start.

Thinking something like

sshs --buildconfig

Would produce or append to the \.ssh\config with as much info in to as it could possible get from known_hosts and then the user could edit from there, could comment out all the new lines to start. This would greatly speed up implementation, especially for people who have a lot of SSH servers they deal with (my known_hosts file has over 50 lines as as example).

Can't install on Fedora 35

Hello,

I have tried to install via the one line command on my Fedora 35 server, but it did not work.

Also I had to install "Development Tools" and "Development Libraries" before running the install script.

[x@vps ~]$ sudo dnf groupinstall "Development Tools" "Development Libraries"

[x@vps ~]$ curl --proto '=https' --tlsv1.2 -sSLf "https://git.io/JBhDb" | sudo sh

  Termscp configuration
> Platform:      linux
> Arch:          x86_64

? Install termscp 0.8.2? [y/N] y
> Detected rpm on your system
> Installing termscp via RPM package
> Downloaded rpm package to /tmp/tmp.l8MyPzgPMv.rpm
> Installing termscp, please wait…
error: Failed dependencies:
	libcrypto.so.10()(64bit) is needed by termscp-0.8.2-1.el7.x86_64
	libcrypto.so.10(OPENSSL_1.0.1_EC)(64bit) is needed by termscp-0.8.2-1.el7.x86_64
	libcrypto.so.10(OPENSSL_1.0.2)(64bit) is needed by termscp-0.8.2-1.el7.x86_64
	libcrypto.so.10(libcrypto.so.10)(64bit) is needed by termscp-0.8.2-1.el7.x86_64
	libssl.so.10()(64bit) is needed by termscp-0.8.2-1.el7.x86_64
	libssl.so.10(libssl.so.10)(64bit) is needed by termscp-0.8.2-1.el7.x86_64

How can I fix this issue?

Thanks!

Can't delete search term in CMD

This happens when running sshs in CMD, PowerShell or Git Bash, so mainly Windows 10.

For example, I type tablet and I get the filtered list, but pressing delete button the field doesn't respond.

I confirm the search field works perfectly on Termux and Ubuntu.

Greetings

Sync .ssh/config with private gist

Feature Request

Is it possible to sync config file with a private gist on github / gitlab / private gitlab server for easy sync between machines?

Thanks in advance

SSH config parse error with global parameters

 %  sshs                                                                                                                         
2022/06/14 17:48:46 /home/shreps/.ssh/config:0: config variable before Host variable
%  head .ssh/config                                                                                                                                                                              
AddressFamily inet

Host bitbucket.org
    Hostname bitbucket.org
    User git
    ControlMaster no

Host github.com
    StrictHostKeyChecking no
    User git

sshs seems not understand / don't ignore the AddressFamily parameter in my ssh config file.

Support Vim Keybinds?

Hello there,
One cool feature can be to support Vim keybindings for navigating to ssh hosts.
Thanks for the current work like a charm!

Need an example config file

Trying to get this to work on MacOS after downloading the latest release. My config file is empty, hence the menu is as well. No idea what the format of this file should look like. Can you please upload an example of this file with details on how things should be entered into the file?

Wrong SHA256

sshs-windows-amd64.exe / sshs-windows-amd64.exe.sha256: v4.1.0 and v4.1.1 seems both wrong, v3.4.0 is ok

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.