Skip to content

number317/ssh-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Quality Gate Status

Intro

This is a small tool to manage ssh server info in command line. Write the servers' info down in the config file so that you don't need to remember the servers' ip, password or port.

Install

  • libconfig: parse cfg

  • ncurse: draw gui

  • sshpass: take password form config file

  • for archlinux:

    pacman -S libconfig ncurse sshpass
    make
    
  • for centos:

    yum install -y libconfig-devel ncurses-devel sshpass
    make
    
  • for debian:

    apt install -y libncurses5-dev libconfig-dev sshpass
    make
    
  • for mac:

    brew install libconfig ncurses
    brew install https://raw.github.com/eugeneoden/homebrew/eca9de1/Library/Formula/sshpass.rb
    sed -i "s/ncursesw/ncurses/g" Makefile
    make
    

Shortcut

  • e: edit config with $EDITOR
  • j: move down
  • k: move up
  • J: next page
  • K: prev page
  • r: reload
  • G: move to last page
  • $: move to last row of current page
  • 0: move to first row of current page
  • 1-9: move to page 1-9
  • /: search
  • n: search next
  • N: search prev
  • s: toggle password
  • q: exit
  • Enter: connect

Config

The default config file is in $HOME/.config/ssh-tool/hosts.cfg, you can also change the file path by ssh-tool /path/to/config_file.

config template:

header=["hostname", "ip", "port", "username", "password", "intro"];
seperation_char="━"
seperation_length=90;
# how many rows to show in one page
hosts_perpage=30;
hosts=(
        {
        hostname="test1";
        ip="111.111.111.111";
        port="22";
        use_key="false"
        username="root";
        password="admin";
        comment="test1";
        },
        {
        hostname="test2";
        ip="222.222.222.222";
        port="22";
        use_key="true"
        username="root";
        password="<usekey>";
        comment="test2";
        },
        {
        hostname="test3";
        ip="333.333.333.333";
        port="22";
        use_key="false"
        username="root";
        password="admin";
        comment="test3";
        },
        {
        hostname="test4";
        ip="444.444.444.444";
        port="22";
        use_key="false"
        username="root";
        password="admin";
        comment="test4";
        }
      );

The config file should have hostname, ip, port, use_key, user, password, intro seven part.

If you use identity file to login in, the password should be the path of identity file.

screenshot

hide

show

docker

docker run -it --rm cheon/ssh-tool ssh-tool