blob: 108a4a2376dcee5b82ab162ba2964e5d630b5e1f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
---
title: "SSH"
date: 2020-01-01T00:00:00-00:00
draft: false
---
# SSH Server
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
```
Run SSH server:
```bash
cointop server -p 2222
```
If the host SSH keys live elsewhere, specify the location:
```bash
cointop server -p 2222 -k ~/.ssh/some-dir/id_rsa
```
SSH into server to see cointop:
```bash
ssh localhost -p 2222
```
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:
```bash
cointop server -p 2222 --user-config-type=username
```
SSH'ing into server with same username will use the same respective config now:
```bash
ssh alice@localhost -p 2222
```
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:
```bash
docker run -p 2222:22 -v ~/.ssh:/keys --entrypoint cointop -it cointop/cointop server -k /keys/id_rsa
```
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
```
|