15
15
16
16
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
17
17
18
- This guide demonstrates how to setup and use code-server.
19
- To reiterate, code-server lets you run VS Code on a remote server and then access it via a browser.
18
+ This guide demonstrates how to setup and use ` code-server ` .
19
+ To reiterate, ` code-server ` lets you run VS Code on a remote server and then access it via a browser.
20
20
21
21
Further docs are at:
22
22
23
- - [ README.md] ( ../README.md ) for a general overview
24
- - [ FAQ.md] ( ./FAQ.md ) for common questions.
25
- - [ CONTRIBUTING.md] ( ../doc/CONTRIBUTING.md ) for development docs
23
+ - [ README] ( ../README.md ) for a general overview
24
+ - [ INSTALL] ( ../doc/install.md ) for installation
25
+ - [ FAQ] ( ./FAQ.md ) for common questions.
26
+ - [ CONTRIBUTING] ( ../doc/CONTRIBUTING.md ) for development docs
26
27
27
- We'll walk you through acquiring a remote machine to run code-server on
28
+ We'll walk you through acquiring a remote machine to run ` code-server ` on
28
29
and then exposing ` code-server ` so you can securely access it.
29
30
30
31
## 1. Acquire a remote machine
31
32
32
- First, you need a machine to run code-server on. You can use a physical
33
+ First, you need a machine to run ` code-server ` on. You can use a physical
33
34
machine you have lying around or use a VM on GCP/AWS.
34
35
35
36
### Requirements
@@ -64,7 +65,6 @@ Once you've signed up and created a GCP project, create a new Compute Engine VM
64
65
- Click ` Change ` under ` Boot Disk ` and change the type to ` SSD Persistent Disk ` and the size
65
66
to ` 32 ` .
66
67
- You can always grow your disk later.
67
- - The default OS of Debian 10 is fine.
68
68
8 . Navigate to ` Networking -> Network interfaces ` and edit the existing interface
69
69
to use a static external IP.
70
70
- Click done to save network interface changes.
@@ -78,7 +78,7 @@ to avoid the slow dashboard.
78
78
79
79
## 2. Install code-server
80
80
81
- [ We have a script] ( ./install.sh ) to install code-server for Linux and macOS.
81
+ We have a [ script] ( ./install.sh ) to install ` code-server ` for Linux and macOS.
82
82
83
83
It tries to use the system package manager if possible.
84
84
@@ -94,7 +94,7 @@ Now to actually install:
94
94
curl -fsSL https://code-server.dev/install.sh | sh
95
95
```
96
96
97
- The install script will print out how to run and start using code-server.
97
+ The install script will print out how to run and start using ` code-server ` .
98
98
99
99
Docs on the install script, manual installation and docker image are at [ ./doc/install.md] ( ./doc/install.md ) .
100
100
@@ -103,45 +103,44 @@ Docs on the install script, manual installation and docker image are at [./doc/i
103
103
** Never** , ** ever** expose ` code-server ` directly to the internet without some form of authentication
104
104
and encryption as someone can completely takeover your machine with the terminal.
105
105
106
- By default, code-server will enable password authentication which will
107
- require you to copy the password from the code-server config file to login. Since it
108
- cannot use TLS by default, it will listen on ` localhost ` to avoid exposing itself
109
- to the world. This is fine for testing but will not work if you want to access ` code-server `
106
+ By default, ` code-server ` will enable password authentication which will require you to copy the
107
+ password from the` code-server ` config file to login. It will listen on` localhost ` to avoid exposing
108
+ itself to the world. This is fine for testing but will not work if you want to access ` code-server `
110
109
from a different machine.
111
110
112
- There are several approaches to securely operating and exposing code-server.
111
+ There are several approaches to securely operating and exposing ` code-server ` .
113
112
114
- ** tip** : You can list the full set of code-server options with ` code-server --help `
113
+ ** tip** : You can list the full set of ` code-server ` options with ` code-server --help `
115
114
116
115
### SSH forwarding
117
116
118
117
We highly recommend this approach for not requiring any additional setup, you just need an
119
118
SSH server on your remote machine. The downside is you won't be able to access ` code-server `
120
- without an SSH client like an iPad. If that's important to you, skip to [ Let's Encrypt] ( #lets-encrypt ) .
119
+ on any machine without an SSH client like on iPad. If that's important to you, skip to [ Let's Encrypt] ( #lets-encrypt ) .
121
120
122
- Recommended reading: https://help.ubuntu.com/community/SSH/OpenSSH/PortForwarding .
123
-
124
- First, ssh into your instance and edit your code-server config file to disable password authentication.
121
+ First, ssh into your instance and edit your ` code-server ` config file to disable password authentication.
125
122
126
123
``` bash
127
124
# Replaces "auth: password" with "auth: none" in the code-server config.
128
125
sed -i.bak ' s/auth: password/auth: none/' ~ /.config/code-server/config.yaml
129
126
```
130
127
131
- Restart code-server with (assuming you followed the guide):
128
+ Restart ` code-server ` with (assuming you followed the guide):
132
129
133
130
``` bash
134
131
systemctl --user restart code-server
135
132
```
136
133
137
134
Now forward local port 8080 to ` 127.0.0.1:8080 ` on the remote instance.
138
135
136
+ Recommended reading: https://help.ubuntu.com/community/SSH/OpenSSH/PortForwarding .
137
+
139
138
``` bash
140
139
# -N disables executing a remote shell
141
140
ssh -N -L 8080:127.0.0.1:8080 < instance-ip>
142
141
```
143
142
144
- Now if you access http://127.0.0.1:8080 locally, you should see code-server!
143
+ Now if you access http://127.0.0.1:8080 locally, you should see ` code-server ` !
145
144
146
145
If you want to make the SSH port forwarding persistent we recommend using
147
146
[ mutagen] ( https://mutagen.io/documentation/introduction/installation ) .
@@ -168,8 +167,8 @@ and sign commits without copying your keys.
168
167
169
168
### Let's Encrypt
170
169
171
- [ Let's Encrypt] ( https://letsencrypt.org ) is a great option if you want to access code-server on an iPad
172
- or do not want to use SSH forwarding. This does require that the remote machine is exposed to the internet.
170
+ [ Let's Encrypt] ( https://letsencrypt.org ) is a great option if you want to access ` code-server ` on an iPad
171
+ or do not want to use SSH forwarding. This does require that the remote machine be exposed to the internet.
173
172
174
173
Assuming you have been following the guide, edit your instance and checkmark the allow HTTP/HTTPS traffic options.
175
174
@@ -198,9 +197,9 @@ reverse_proxy 127.0.0.1:8080
198
197
sudo systemctl reload caddy
199
198
```
200
199
201
- Visit ` https://<your-domain-name> ` to access code-server. Congratulations!
200
+ Visit ` https://<your-domain-name> ` to access ` code-server ` . Congratulations!
202
201
203
- In a future release we plan to integrate Let's Encrypt directly with code-server to avoid
202
+ In a future release we plan to integrate Let's Encrypt directly with ` code-server ` to avoid
204
203
the dependency on caddy.
205
204
206
205
### Self Signed Certificate
@@ -210,13 +209,12 @@ have to use [Let's Encrypt](#lets-encrypt) instead. See the [FAQ](https://github
210
209
211
210
Recommended reading: https://security.stackexchange.com/a/8112 .
212
211
213
- We recommend this as a last resort as self signed certificates do not work with iPads and can
214
- cause other bizarre issues. Not to mention all the warnings when you access code-server.
212
+ We recommend this as a last resort because self signed certificates do not work with iPads and can
213
+ cause other bizarre issues. Not to mention all the warnings when you access ` code-server ` .
215
214
Only use this if:
216
215
217
- 1 . You do not want to buy a domain.
218
- 2 . You cannot expose the remote machine to the internet.
219
- 3 . You do not want to use SSH forwarding.
216
+ 1 . You do not want to buy a domain or you cannot expose the remote machine to the internet.
217
+ 2 . You do not want to use SSH forwarding.
220
218
221
219
ssh into your instance and edit your code-server config file to use a randomly generated self signed certificate:
222
220
@@ -229,32 +227,32 @@ sed -i.bak 's/bind-addr: 127.0.0.1:8080/bind-addr: 0.0.0.0:443/' ~/.config/code-
229
227
sudo setcap cap_net_bind_service=+ep /usr/lib/code-server/lib/node
230
228
```
231
229
232
- Assuming you have been following the guide, restart code-server with:
230
+ Assuming you have been following the guide, restart ` code-server ` with:
233
231
234
232
``` bash
235
233
systemctl --user restart code-server
236
234
```
237
235
238
236
Edit your instance and checkmark the allow HTTPS traffic option.
239
237
240
- Visit ` https://<your-instance-ip> ` to access code-server.
238
+ Visit ` https://<your-instance-ip> ` to access ` code-server ` .
241
239
You'll get a warning when accessing but if you click through you should be good.
242
240
243
241
To avoid the warnings, you can use [ mkcert] ( https://mkcert.dev ) to create a self signed certificate
244
- trusted by your OS and then pass it into code-server via the ` cert ` and ` cert-key ` config
242
+ trusted by your OS and then pass it into ` code-server ` via the ` cert ` and ` cert-key ` config
245
243
fields.
246
244
247
245
### Change the password?
248
246
249
- Edit the ` password ` field in the code-server config file at ` ~/.config/code-server/config.yaml `
250
- and then restart code-server with:
247
+ Edit the ` password ` field in the ` code-server ` config file at ` ~/.config/code-server/config.yaml `
248
+ and then restart ` code-server ` with:
251
249
252
250
``` bash
253
251
systemctl --user restart code-server
254
252
```
255
253
256
254
### How do I securely access development web services?
257
255
258
- If you're working on a web service and want to access it locally, code-server can proxy it for you.
256
+ If you're working on a web service and want to access it locally, ` code-server ` can proxy it for you.
259
257
260
- See [ FAQ.md ] ( https://github.com/cdr/code-server/blob/master/doc/FAQ.md#how-do-i-securely-access-web-services ) .
258
+ See the [ FAQ] ( https://github.com/cdr/code-server/blob/master/doc/FAQ.md#how-do-i-securely-access-web-services ) .
0 commit comments