@josbroers/ssh-connect

Easily connect and manage your SSH connections.


Keywords
SSH, SCP, Server tools, Linux, server-tools
License
MIT
Install
npm install @josbroers/ssh-connect@1.3.2-canary.0

Documentation

SSH Connect

npm

A package to easily connect and manage your SSH connections.

Note: the arguments are optional

Table of contents

1. Node.js

First install the Node.js higher or equal to 16. Use the JavaScript Tool Manager Volta or the Node Version Manager.

2. Configure

Before you can use this package as an executable you need to create a JSON file. Run the following command to create this file:

ssh-connect configure <path_for_file>

3. Scripts

To create a connections file, use:

ssh-connect configure <path_for_file>

To list all the defined connections, use:

ssh-connect list <path_for_file>

To connect to a listed connection, use:

ssh-connect connect <path_to_file> <connection_name>

To add a new connection, use:

ssh-connect add <path_to_file> <connection_name>

To remove a listed connection, use:

ssh-connect remove <path_to_file> <connection_name>

To edit a listed connection, use:

ssh-connect edit <path_to_file> <connection_name>

To get the IP-address of a listed connection, use:

ssh-connect get <path_to_file> <connection_name>

To list all the available aliases, use:

ssh-connect aliases <path_for_file>

3.2 Aliases

You can use aliases to predefine the type, connection:

alias ssh-con="ssh-connect connect $HOME/connections.json"
alias ssh-add="ssh-connect add $HOME/connections.json"
alias ssh-rm="ssh-connect remove $HOME/connections.json"
alias ssh-ls="ssh-connect list $HOME/connections.json"
alias ssh-edit="ssh-connect edit $HOME/connections.json"
alias ssh-get="ssh-connect get $HOME/connections.json"
alias ssh-alias="ssh-connect aliases $HOME/connections.json"

You can take it even further by making aliases for specific connection names:

alias google="ssh-connect connect $HOME/connections.json google"
alias ssh-google="ssh-connect connect $HOME/connections.json google"

alias cloudflare="ssh-connect connect $HOME/connections.json cloudflare"
alias ssh-cloudflare="ssh-connect connect $HOME/connections.json cloudflare"