2
0
mirror of https://github.com/miguelmota/cointop synced 2024-11-05 00:00:14 +00:00
cointop/docs/content/ssh.md

74 lines
1.6 KiB
Markdown
Raw Normal View History

2021-02-21 05:11:27 +00:00
---
title: "SSH"
date: 2020-01-01T00:00:00-00:00
draft: false
---
# SSH Server
2021-04-06 08:11:34 +00:00
The SSH server requires that the host has SSH keys, so generate SSH keys if not already:
```bash
$ ssh-keygen
```
Check keys were generated:
```bash
$ ls ~/.ssh
id_rsa id_rsa.pub
```
2021-02-21 05:11:27 +00:00
Run SSH server:
```bash
cointop server -p 2222
```
2021-04-06 08:11:34 +00:00
If the host SSH keys live elsewhere, specify the location:
```bash
cointop server -p 2222 -k ~/.ssh/some-dir/id_rsa
```
2021-02-21 05:11:27 +00:00
SSH into server to see cointop:
```bash
ssh localhost -p 2222
```
2021-04-06 08:11:34 +00:00
The cointop SSH server will use the client's public SSH key as the identifier for persistent config by default. You may change it to use the username instead:
2021-02-21 05:11:27 +00:00
```bash
2021-04-06 08:11:34 +00:00
cointop server -p 2222 --user-config-type=username
2021-02-21 05:11:27 +00:00
```
2021-04-06 08:11:34 +00:00
SSH'ing into server with same username will use the same respective config now:
2021-02-21 05:11:27 +00:00
```bash
2021-04-06 08:11:34 +00:00
ssh alice@localhost -p 2222
2021-02-21 05:11:27 +00:00
```
2021-04-06 08:11:34 +00:00
Pass arguments to cointop on SSH server by using SSH `-t` flag followed by cointop command and arguments. For example:
```bash
ssh localhost -p 2222 -t cointop --colorscheme synthwave
```
## Using docker to run SSH server:
2021-02-21 05:11:27 +00:00
```bash
docker run -p 2222:22 -v ~/.ssh:/keys --entrypoint cointop -it cointop/cointop server -k /keys/id_rsa
```
2021-04-06 08:11:34 +00:00
cointop server writes the client config to `/tmp/cointop_config` within the container, so to make it persistent in host attach a volume. The following example will to write the cached config to `~/.cache/cointop` on the host:
```bash
docker run -p 2222:22 -v ~/.ssh:/keys -v ~/.cache/cointop:/tmp/cointop_config --entrypoint cointop -it cointop/cointop server -k /keys/id_rsa
```
## SSH demo
```bash
ssh cointop.sh
```