Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.

Commit 8bc267f

Browse files
author
Katie Horne
committed
Fix nav
1 parent 9bb30b4 commit 8bc267f

File tree

1 file changed

+21
-24
lines changed

1 file changed

+21
-24
lines changed

admin/environment-management/ssh-access.md

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,33 @@ advanced functionality like X11 forwarding or `sshd_config` specifications.
2020
If SSH is the primary mode of access to Coder for your users, consider
2121
running a full OpenSSH server with `systemd` inside your image instead.
2222

23-
To do so:
23+
To do so, add the following to your Dockerfile:
2424

25-
1. Add the following to your Dockerfile:
25+
```Dockerfile
26+
FROM ubuntu:20.04
27+
RUN apt-get update && apt-get install -y \
28+
build-essential \
29+
systemd \
30+
openssh-server
2631

27-
```Dockerfile
28-
FROM ubuntu:20.04
29-
RUN apt-get update && apt-get install -y \
30-
build-essential \
31-
systemd \
32-
openssh-server
32+
# Start OpenSSH with systemd
33+
RUN systemctl enable ssh
3334

34-
# Start OpenSSH with systemd
35-
RUN systemctl enable ssh
35+
# recommended: remove the system-wide environment override
36+
RUN rm /etc/environment
3637

37-
# recommended: remove the system-wide environment override
38-
RUN rm /etc/environment
39-
40-
# recommended: adjust OpenSSH config
41-
RUN echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config && \
42-
echo "X11Forwarding yes" >> /etc/ssh/sshd_config && \
43-
echo "X11UseLocalhost no" >> /etc/ssh/sshd_config
44-
45-
```
38+
# recommended: adjust OpenSSH config
39+
RUN echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config && \
40+
echo "X11Forwarding yes" >> /etc/ssh/sshd_config && \
41+
echo "X11UseLocalhost no" >> /etc/ssh/sshd_config
42+
```
4643

47-
1. Make sure that you're creating your environments with the [CVM
48-
option](https://coder.com/docs/environments/cvms) enabled.
44+
Then, make sure that you're creating your environments with the [CVM
45+
option](https://coder.com/docs/environments/cvms) enabled.
4946

50-
> If Coder detects a running TCP server on port 22, it will forward incoming
51-
> SSH traffic to this server. This means that environments should not run a
52-
> TCP server on port 22 unless it can properly handle incoming SSH traffic.
47+
> If Coder detects a running TCP server on port 22, it will forward incoming
48+
> SSH traffic to this server. This means that environments should not run a
49+
> TCP server on port 22 unless it can properly handle incoming SSH traffic.
5350
5451
At startup, Coder injects the user's SSH key into `~/authorized_keys` inside
5552
your environment to facilitate authentication with OpenSSH. For the best

0 commit comments

Comments
 (0)