Skip to content

Commit 81306c5

Browse files
authored
Merge pull request #4182 from AkihiroSuda/docs
docs: usage: split SSH to a separate page
2 parents 19dd37f + 5f8212b commit 81306c5

File tree

3 files changed

+48
-28
lines changed

3 files changed

+48
-28
lines changed

website/content/en/docs/faq/_index.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,9 @@ weight: 6
5050
Password is disabled and locked by default.
5151
You have to use `limactl shell bash` (or `lima bash`) to open a shell.
5252

53-
Alternatively, you may also directly ssh into the guest: `ssh -p <PORT> -i ~/.lima/_config/user -o NoHostAuthenticationForLocalhost=yes 127.0.0.1`.
54-
The port number can be inspected by running `limactl list`.
55-
e.g.,
56-
```bash
57-
limactl list --format '{{ .SSHLocalPort }}' default
58-
```
53+
{{% fixlinks %}}
54+
Try virtiofs. See [`Usage » SSH`]({{< ref "/docs/usage/ssh" >}})
55+
{{% /fixlinks %}}
5956

6057
#### "Does Lima work on ARM Mac?"
6158
Yes

website/content/en/docs/usage/_index.md

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -50,28 +50,6 @@ lima uname -a
5050
```
5151
The `lima` command also accepts the instance name as the environment variable `$LIMA_INSTANCE`.
5252

53-
54-
SSH can be used too:
55-
```console
56-
$ limactl ls --format='{{.SSHConfigFile}}' default
57-
/Users/example/.lima/default/ssh.config
58-
59-
$ ssh -F /Users/example/.lima/default/ssh.config lima-default
60-
```
61-
62-
#### Using SSH without the `-F` flag
63-
64-
To connect directly without specifying the config file, add this to your `~/.ssh/config`:
65-
66-
```
67-
Include ~/.lima/*/ssh.config
68-
```
69-
70-
Then you can connect directly:
71-
```bash
72-
ssh lima-default
73-
```
74-
7553
### Shell completion
7654
- To enable bash completion, add `source <(limactl completion bash)` to `~/.bash_profile`.
7755
- To enable zsh completion, see `limactl completion zsh --help`
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: SSH
3+
weight: 3
4+
---
5+
6+
Instead of the `limactl shell` command, SSH can be used too:
7+
8+
```console
9+
$ limactl ls --format='{{.SSHConfigFile}}' default
10+
/Users/example/.lima/default/ssh.config
11+
12+
$ ssh -F /Users/example/.lima/default/ssh.config lima-default
13+
```
14+
15+
This is useful for interoperability with other software that expects the SSH connectivity.
16+
17+
## Using SSH without additional options
18+
19+
Add the following line to your `~/.ssh/config`:
20+
21+
```
22+
Include ~/.lima/*/ssh.config
23+
```
24+
25+
Then you can connect directly without specifying `-F`:
26+
```bash
27+
ssh lima-default
28+
```
29+
30+
This configuration is notably useful for the Remote Development mode of [Visual Studio Code](../examples/vscode.md).
31+
32+
## Using SSH without a config file
33+
34+
If your SSH client does not support a config file, try specifying an equivalent of the following command:
35+
36+
```bash
37+
ssh -p <PORT> -i ~/.lima/_config/user -o NoHostAuthenticationForLocalhost=yes 127.0.0.1
38+
```
39+
40+
The port number can be inspected as follows:
41+
```bash
42+
limactl list --format '{{ .SSHLocalPort }}' default
43+
```
44+
45+
See also `.lima/default/ssh.config`.

0 commit comments

Comments
 (0)