sshcli is a command-line interface tool that utilizes the ~/.ssh/config
file as a profile database. It allows you to add or remove profiles and connect to those profiles in an interactive environment.
To compile the code, you must have Golang installed on your system.
- ssh and sftp commands must be available in the path environment.
- sshpass tool can be installed optionally if password authentication is needed.
- The passwords.json file acts as a password database since the ssh config file doesn't support storing passwords. you can add your clear-text passwords to to file and the tool will encrypt them (based on isEncrypted value) after the first execution. Alternatively, ssh passwords can be added to the new or existing profiles using "-host VM10 --askpass" parameters.
- To make the best use of the tool in Windows OS, run it in the Windows Terminal app.
1: Clone the repository.
2: Run "go mod tidy" to download the extra modules.
3: How to compile:
+ Running on windows , compiling for windows:
- `$env:GOOS="windows"; $env:GOARCH="amd64"; $env:CGO_ENABLED="0"; go build .`
+ running on Apple Silicon , compiling for Mac:
- `env GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -ldflags "-X main.CompileTime=`date -u +.%Y%m%d.%H%M%S`"`
+ running on Apple Silicon , compiling for linux x86_64:
- `env GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X main.CompileTime=`date -u +.%Y%m%d.%H%M%S`"`
4: Add the binary to the path varible (Optional).
5: Fill ~/.ssh/config file and add the target credentials.
6: Run the tool by calling the binary.
You can download the latest binary from the release section for your OS/CPU architecture.
Use /
to bring up the search field to find the host from the list more easily.
# ./sshcli
# ./sshcli --action add --host t001 --hostname 10.10.10.10 --key '~/.ssh/id_rsa' --username root --port 22 --askpass
Enter Password:
# ./sshcli --action remove --host t001
~ ➤ sshcli -h
Usage of sshcli:
-action string
Action to perform: add, remove
-askpass
Password prompt
-host string
Host alias
-hostname string
HostName or IP address
-key string
IdentityFile path
-port string
Port Number
-username string
Username
-version
prints the compile time (version)