Lightweight ssh client supporting grouping, search, and batch login released v0.1.14

Open source address: https://github.com/trzsz/trzsz-ssh

New version v0.1.14 Basic usage of group tags and search:

  • If there are a large number of servers, grouping tags can quickly find the target server when pressing search. GroupLabels  / 

  • After pressing to enter a grouping label, it can be locked; pressing again can enter another grouping label and lock it again. / 回车 / 回车

  • In non-search mode, press to clear the current search tag; pressing in search mode has the same effect. E  Ctrl + E 

  • Supports configuring multiple grouping labels separated by spaces; supports configuring multiple groups . GroupLabels  GroupLabels

  • Supports configuring group labels on multiple Host nodes in the form of wildcard *, and tssh all labels will be summarized.

    # 以下 testAA 具有标签 group1 group2 label3 label4 group5 ,可以加上 `#!!` 前缀,以兼容标准 ssh
    Host test*
        #!! GroupLabels group1 group2
        #!! GroupLabels label3
    Host testAA
        #!! GroupLabels label4 group5

v0.1.14 supports the new group label method, which solves a pain point:

  • It turns out that unique configuration items (such as "remember password") are in a separate configuration file ( ), because configurations it does not recognize are not allowed to appear in it. After that, it is supported to configure unique configuration items in , just add it in front of the configuration item , as before . For , this is a comment; for , this is a normal configuration item. tssh  ~/.ssh/password  openssh  ~/.ssh/config v0.1.14  ~/.ssh/config  tssh  #!!  #!! GroupLabels label openssh  tssh 


Introduction to tssh

Does your favorite ssh terminal have useful server management functions? Does it support remembering passwords? Are there any useful file transfer tools?

tssh supports selecting or searching the configured server, supports vim operating habits, and solves the server management problem of ssh terminal. ~/.ssh/config 

tssh supports selecting multiple servers at one time, logging in in batches, and executing pre-specified commands in batches, making it easy to quickly complete batch server operations.

tssh supports configuring server login passwords, eliminating the trouble of manually entering passwords each time (it is recommended to use public and private keys to log in to servers that you can control).

tssh has built-in support for the trzsz (trz /tsz) file transfer tool, which also solves the problem of slow upload speed in Windows.   trzsz ssh 

On the author's MacOS, the upload speed is around 10 MB/s, and it can reach more than 80 MB/s. trzsz ssh  tssh 

installation method

The client installation method is as follows (choose one): trzsz-ssh ( tssh ) 

  • Windows can be installed with scoop / winget / choco      

    scoop install tssh / winget install tssh / choco install tssh
    scoop install tssh
    
    winget install tssh
    
    choco install tssh
    
  • MacOS can be installed with homebrew  

    brew install trzsz-ssh
    brew update
    brew install trzsz-ssh
    
  • Ubuntu can be installed with apt

    sudo apt install tssh
    sudo apt update && sudo apt install software-properties-common
    sudo add-apt-repository ppa:trzsz/ppa && sudo apt update
    
    sudo apt install tssh
    
  • Debian can be installed with apt

    sudo apt install tssh
    sudo apt install curl gpg
    curl -s 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x7074ce75da7cc691c1ae1a7c7e51d1ad956055ca' \
      | gpg --dearmor -o /usr/share/keyrings/trzsz.gpg
    echo 'deb [signed-by=/usr/share/keyrings/trzsz.gpg] https://ppa.launchpadcontent.net/trzsz/ppa/ubuntu jammy main' \
      | sudo tee /etc/apt/sources.list.d/trzsz.list
    sudo apt update
    
    sudo apt install tssh
    
  • Linux can be installed with yum

    sudo yum install tssh
    • It is recommended to use the wlnmp source in China. To install tssh, you only need to add the wlnmp source (it is not necessary to configure the epel source). Take CentOS as an example:  

      sudo rpm -ivh https://mirrors.wlnmp.com/centos/wlnmp-release-centos.noarch.rpm
      
      sudo yum install tssh
      
    • You can also use the gemfury source (common to all operating systems as long as the network is connected)  

      echo '[trzsz]
      name=Trzsz Repo
      baseurl=https://yum.fury.io/trzsz/
      enabled=1
      gpgcheck=0' | sudo tee /etc/yum.repos.d/trzsz.repo
      
      sudo yum install tssh
      
  • ArchLinux can be installed with yay  

    yay -S tssh
    yay -Syu
    yay -S tssh
    
  • Install directly with Go (requires go 1.20 or above)

    go install github.com/trzsz/trzsz-ssh/cmd/tssh@latest
    go install github.com/trzsz/trzsz-ssh/cmd/tssh@latest
    

    After installation, tssh the program is usually located in a directory (usually in Windows ). ~/go/bin/  C:\Users\your_name\go\bin\ 

  • The applicable version can be downloaded directly from Releases  

    或者用 Go 编译( 要求 go 1.20 以上 )
    git clone https://github.com/trzsz/trzsz-ssh.git
    cd trzsz-ssh
    go build ./cmd/tssh
    

You need to install trzsz on the server to use upload and download. You can choose any one to install: Go version (⭐ recommended), Py version , Js version .   trz / tsz  

If trzsz is not installed on the server , it can still be used , but uploading and downloading are not used.  tssh trz / tsz 

Instructions

~/ Represents the HOME directory. In Windows, replace the following with . ~/  C:\Users\your_name\

  • Generate a key pair on the client, which is usually stored as follows (only one type is enough): ~/.ssh/ 

    • ssh-keygen -t ed25519 Generate the private key and public key of ED25519 . ~/.ssh/id_ed25519 ~/.ssh/id_ed25519.pub
    • ssh-keygen -t rsa -b 4096 Generate RSA private key and public key . ~/.ssh/id_rsa ~/.ssh/id_rsa.pub
  • Log in to the server and append the public key (that is, the file content of the suffix when generating the key pair earlier ) into the file on the server . .pub  ~/.ssh/authorized_keys 

    One line represents the public key of a client. Be careful to set the correct permissions: ~/.ssh/authorized_keys 

    chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys
     
  • Configure the file on the client, for example: ~/.ssh/config 

    Host alias1
        HostName 192.168.0.1
        Port 22
        User your_name
    Host alias2
        HostName 192.168.0.2
        Port 22
        User your_name
     
  • Use the command to log in to the server. The command logs in to the corresponding server. tssh tssh alias1  ~/.ssh/config  alias1 

  • To execute the command directly (without parameters), you can select the server configured in (Search) and log in. tssh  ~/.ssh/config 

Batch login

  • Supports selecting multiple servers at once (to enable Python API , but not required ) , batch login, and supports batch execution of pre-specified commands. iTerm2  Allow all apps to connect tmux  Windows Terminal 

  • Press , and so on to select or cancel the current server. If it cannot be selected, it means that the current terminal is not supported yet, please run it first . SpaceCtrl+X  tmux

  • Pressing will open a split-screen batch login, a new window will open for batch login, and a new tab will open for batch login. Ctrl+P Ctrl+W Ctrl+T 

  • tssh If you start without parameters, you can log in to the server in batches. If you start with parameters, you can execute specified commands in batches. It supports entering the interactive shell after executing the specified command, but semicolon is not supported and can be replaced by semicolon. Example: -o RemoteCommand  Windows Terminal  ; |cat&& 

    tssh -t -o RemoteCommand='ping -c3 trzsz.github.io ; bash'
    tssh -t -o RemoteCommand="ping -c3 trzsz.github.io |cat&& bash"
     

Group labels

  • If there are a large number of servers, grouping tags can quickly find the target server when pressing search. GroupLabels  / 

  • After pressing to enter a grouping label, it can be locked; pressing again can enter another grouping label and lock it again. / 回车 / 回车

  • In non-search mode, press to clear the current search tag; pressing in search mode has the same effect. E  Ctrl + E 

  • Supports configuring multiple grouping labels separated by spaces; supports configuring multiple groups . GroupLabels  GroupLabels

  • Supports configuring group labels on multiple Host nodes in the form of wildcard *, and tssh all labels will be summarized.

    # The following testAA has labels group1 group2 label3 label4 group5, which can be prefixed with `#!!` to be compatible with standard ssh 
    Host  test* 
        #!! GroupLabels group1 group2 
        #!! GroupLabels label3 
    Host  testAA 
        #!! GroupLabels label4 group5
     

Remember password

  • In order to be compatible with standard ssh, the password can be configured separately in or prefixed with it . ~/.ssh/password  ~/.ssh/config  #!! 

  • It is recommended to use the previous key authentication method, as the password security is weaker. If you must use a password, it is recommended to set the permissions, such as: ~/.ssh/password 

    chmod 700 ~/.ssh && chmod 600 ~/.ssh/password
     
  • The password for the following configuration and is , and other passwords starting with : test1  test2  123456 test  111111

    # If configured in ~/.ssh/config, you can add `#!!` prefix to be compatible with standard ssh 
    Host  test1 
        #!! Password 123456 
    # If configured in ~/.ssh/password, you do not need to consider whether Compatible with standard ssh Host test2 Password 123456 # ~/.ssh/config and ~/.ssh/password support wildcards, and tssh will use the first matching value. # Here we hope that test2 uses a different password from other test*, so test* is placed after test2. Host test* Password 111111
    
     
         
    
    
    
    
     
         
     
  • Supports remembering private keys (recommended ). Supports configuration with and supports using the private key file name instead of the Host alias to set a common key . Example: Passphrase ssh-agent  IdentityFile  Passphrase

    # IdentityFile and Passphrase are configured together. You can add the `#!!` prefix to be compatible with standard ssh 
    Host  test1 
    IdentityFile /path/to/id_rsa     #!! Passphrase 123456 # Configure the universal private key in ~/.ssh/config~/ The Passphrase # corresponding to .ssh/id_ed25519 can add the wildcard * to avoid the file name appearing in the server list when tssh searches and selects. Host id_ed25519*     #!! Passphrase 111111 # If configured in ~/.ssh/password, the wildcard * is not required and will not appear in the server list. Host id_rsa Passphrase 111111     
    
    
    
    
     
    
    
    
     
         
     

Remember the answer

  • In addition to private keys and passwords, there is another login method, which is called keyboard interactive in English. The server returns some questions and the client can log in by providing the correct answers. Many customized one-time passwords are implemented in this way.

  • If the answer is fixed, tssh support "remember answer". Most of the time there is only one problem, just configure it . For multiple questions, the answer to each question can be configured according to the serial number or the hex code of the question. QuestionAnswer1 

  • Using login, the hex encoding of the problem will be output, so you know how to use hex encoding for configuration. Configuration example: tssh --debug 

    # If configured in ~/.ssh/config, you can add the `#!!` prefix to be compatible with standard ssh 
    Host  test1 
    QuestionAnswer1 answer one Host test2 QuestionAnswer1 answer one QuestionAnswer2 answer two QuestionAnswer3 answer three Host test3 6e616d653a20 my_name # Among them `6e616d653a20 ` is the hex code of question `name: ` 636f64653a20 my_code # where `636f64653a20` is the hex code of question `code: `     
     
         
         
         
     
         
         
     

Optional

  • The following custom configurations are supported in Windows (yes ): ~/.tssh.conf C:\Users\your_name\.tssh.conf 

    # SSH configuration path, the default is ~/.ssh/config
     ConfigPath = ~/.ssh/config 
    
    # Extended configuration path, the default is ~/.ssh/password
     ExConfigPath = ~/.ssh/password 
    
    # When trz is uploaded, the dialog box opens The path, when empty, open the last path, the default is empty
     DefaultUploadPath = ~/Downloads 
    
    # tsz When downloading, the path to automatically save, when it is empty, a dialog box pops up to select manually, the default is empty
     DefaultDownloadPath = ~/Downloads 
    
    # tssh search And when selecting the server, the number of records displayed on each page, the default is 10
     PromptPageSize = 10
     

Other functions

  • When using background running, you can add parameters together, so that when the background process exits due to disconnection, etc., it will automatically reconnect. -f  --reconnect 

  • Use the drag-and-drop upload function to enable it. If you want to enable it by default, you can configure it in the or extension configuration : --dragfile  ~/.ssh/config  ExConfigPath 

    Host  * 
      # If configured in ~/.ssh/config, you can add `#!!` prefix to be compatible with standard ssh 
    EnableDragFile Yes   
     
  • Use the disable trzsz function. If you want to disable it by default, you can configure it in the or extended configuration : -oEnableTrzsz=No  ~/.ssh/config  ExConfigPath 

    Host  server1 
      # If configured in ~/.ssh/config, you can add the `#!!` prefix to be compatible with standard ssh 
    EnableTrzsz No   
     
  • As long as you add "remember password" and "remember answer" mentioned above in front of the configuration items, you can configure the cipher text to prevent people from snooping on the screen. Ciphertext can solve the problem of password inclusion. enc #

    Run , enter the plaintext of the password or answer (will not be echoed), and you can get the ciphertext for configuration (the same password will have different encryption results each time): tssh --enc-secret

    Host  server2 
      # If configured in ~/.ssh/config, you can add the `#!!` prefix to be compatible with standard ssh 
    encPassword de88c4dbdc95d85303682734e2397c4d8dd29bfff09ec53580f31dd40291fc8c7755 encQuestionAnswer1 93956f6e7e9f2 aef3af7d6a61f7046dddf14aa4bbd9845dbb836fe3782b62ac0d89f   
       
     

shortcut key

operate Global shortcut keys Non-search shortcut keys Shortcut key description
Confirm Enter   Confirm and log in
Quit/Exit Ctrl+C Ctrl+Q q Q Cancel and exit
Move Prev Ctrl+K Shift+Tab ↑ k K Move cursor up
Move Next Ctrl+J Tab ↓ not a word Move cursor down
Page Up Ctrl+H Ctrl+U Ctrl+B PageUp ← h H u U b B turn one page up
Page Down Ctrl+L Ctrl+D Ctrl+F PageDown → l L d D f F Turn down one page
Goto Home Home g jump to first line
Got to End End G Jump to the last row
EraseKeys Ctrl+E and and Erase search keywords
TglSearch /   Toggle search function
Tgl Help ?   Switch help information
TglSelect Ctrl+X Ctrl+Space Alt+Space Space x X Toggle selected state
SelectAll Ctrl+A a A Select all current page
SelectOpp Ctrl+O the O Invert current page
Open Wins Ctrl+W w W New window batch login
Open Tabs Ctrl+T t T New Tab batch login
Open Pane Ctrl+P p P Split screen batch login

troubleshooting

  • In the Warp terminal, the Blocks function needs to be renamed to , and it is recommended to create a soft link (friendly for updates): tssh  ssh

    sudo ln -sv $(which tssh) /usr/local/bin/ssh
     
    • --dragfile Parameters may disable the Warp chunking function. Please refer to the previous configuration to enable the drag and drop function. EnableDragFile 

    • After dragging files or directories into the Warp terminal, the upload may not be triggered immediately, and you need to press 回车the key one more time to upload.

  • If you are using Windows 7 or an older version of Windows 10, etc., you encounter the error. enable virtual terminal failed 

  • If a unique configuration item is configured in , a standard error will be reported . ~/.ssh/config  tssh  ssh  Bad configuration option

    • You can add a prefix to the error configuration item , and the standard will treat it as a comment and consider it to be one of the valid configurations. #!! ssh  tssh 

Screen recording demonstration

Guess you like

Origin www.oschina.net/news/268302/tssh-0-1-14