Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yurenchen000/ssh-keep
keep your ssh connection survive from network fluctuation or wifi switching
https://github.com/yurenchen000/ssh-keep
openssh ssh tunnel
Last synced: about 2 months ago
JSON representation
keep your ssh connection survive from network fluctuation or wifi switching
- Host: GitHub
- URL: https://github.com/yurenchen000/ssh-keep
- Owner: yurenchen000
- Created: 2022-12-23T10:37:22.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-28T19:03:12.000Z (about 1 year ago)
- Last Synced: 2024-10-18T16:31:09.219Z (2 months ago)
- Topics: openssh, ssh, tunnel
- Language: Go
- Homepage:
- Size: 28.3 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
ssh-keep
========[![build](https://github.com/yurenchen000/ssh-keep/actions/workflows/release.yml/badge.svg)](https://github.com/yurenchen000/ssh-keep/releases)
[![go-report](https://goreportcard.com/badge/github.com/yurenchen000/ssh-keep)](https://goreportcard.com/report/github.com/yurenchen000/ssh-keep)[![release](https://img.shields.io/github/v/release/yurenchen000/ssh-keep)](https://github.com/yurenchen000/ssh-keep/releases)
## 🍵 what's this
keep your ssh connection survive from network fluctuation or wifi switching
Inspired by
https://eternalterminal.devIt work as a relay-connection between ssh-client and ssh-server.
```
[ssh server]
|
tcp
|
relay-client ---- relay-connection ---- relay-server
|
stdio
|
[ssh client]
```the relay-client & relay-server fake a persistent connection,
quietly reconnect and never noitfy ssh-client/ssh-server.## 🍵 build
```bash
GO111MODULE=off GOPATH=$PWD go build -o ssh-keep-c client.go
GO111MODULE=off GOPATH=$PWD go build -o ssh-keep-s server.go
```then got
- ssh-keep-c //the client side, ssh proxy cmd
- ssh-keep-s //the server side, ssh relay## 🍵 deploy
### 1. server side
connect to your real ssh server :22.
and listen on a tcp port (:2021 for example, wait for client connect)Run manually
```sh
./ssh-keep-s -server 127.0.0.1:22 -listen :2021
```OR Use systemd service:
```sh
#install
sudo cp -pv ssh-keep-s /usr/local/bin/
sudo cp -pv ssh-keep.service /etc/systemd/system/
sudo systemctl daemon-reload#start
sudo systemctl start ssh-keep.service#auto start
sudo systemctl enable ssh-keep.service
```
### 2. client side```bash
ssh -o ProxyCommand='ssh-keep-c --server %h:2021 2>/dev/null' your_ssh_server
```or put it into ssh_config
```cfg
## setup a ssh-keep client
Host your_ssh_server
ProxyCommand ssh-keep-c --server %h:2021 2>/dev/null# Tell ssh don't kill connection when alive msg timeout
# (Useful when PC suspend/hibernate/offline hours)
ServerAliveInterval 0
TCPKeepAlive no
```//then it can also work as a jump host (get the benefit of stable connection)
```cfg
## other can use it as a jump host
Host other_ssh_server
ProxyJump your_ssh_server
```## 🍵 tips
when lose connect with server, you can't exit by `Ctrl+D`
//that's bash exit key, but you lose connection with it.use
- `Enter ~ . ` to exit
- `Enter ~ ? ` for help//that's ssh key.