@@ -20,36 +20,33 @@ advanced functionality like X11 forwarding or `sshd_config` specifications.
2020If SSH is the primary mode of access to Coder for your users, consider
2121running 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
5451At startup, Coder injects the user's SSH key into ` ~/authorized_keys ` inside
5552your environment to facilitate authentication with OpenSSH. For the best
0 commit comments