|
20 | 20 | - [Proxying to a Vue app](#proxying-to-a-vue-app) |
21 | 21 | - [Proxying to an Angular app](#proxying-to-an-angular-app) |
22 | 22 | - [Proxying to a Svelte app](#proxying-to-a-svelte-app) |
23 | | -- [SSH into code-server on VS Code](#ssh-into-code-server-on-vs-code) |
24 | | - - [Option 1: cloudflared tunnel](#option-1-cloudflared-tunnel) |
25 | | - - [Option 2: ngrok tunnel](#option-2-ngrok-tunnel) |
26 | 23 |
|
27 | 24 | <!-- END doctoc generated TOC please keep comment here to allow auto update --> |
28 | 25 | <!-- prettier-ignore-end --> |
@@ -435,93 +432,3 @@ const config = { |
435 | 432 | 3. Access app at `<code-server-root>/absproxy/5173/` e.g. `http://localhost:8080/absproxy/5173/ |
436 | 433 |
|
437 | 434 | For additional context, see [this Github Issue](https://github.com/sveltejs/kit/issues/2958) |
438 | | - |
439 | | -## SSH into code-server on VS Code |
440 | | - |
441 | | -[](https://ohmyz.sh/) [](https://img.shields.io/badge/Terminal-2E2E2E?style=for-the-badge&logo=Windows+Terminal&logoColor=ffffff) [](vscode:extension/ms-vscode-remote.remote-ssh) |
442 | | - |
443 | | -Follow these steps where code-server is running: |
444 | | - |
445 | | -1. Install `openssh-server`, `wget`, and `unzip`. |
446 | | - |
447 | | -```bash |
448 | | -# example for Debian and Ubuntu operating systems |
449 | | -sudo apt update |
450 | | -sudo apt install wget unzip openssh-server |
451 | | -``` |
452 | | - |
453 | | -2. Start the SSH server and set the password for your user, if you haven't already. If you use [deploy-code-server](https://github.com/coder/deploy-code-server), |
454 | | - |
455 | | -```bash |
456 | | -sudo service ssh start |
457 | | -sudo passwd {user} # replace user with your code-server user |
458 | | -``` |
459 | | - |
460 | | -### Option 1: cloudflared tunnel |
461 | | - |
462 | | -[](https://github.com/cloudflare/cloudflared) |
463 | | - |
464 | | -1. Install [cloudflared](https://github.com/cloudflare/cloudflared#installing-cloudflared) on your local computer and remote server |
465 | | -2. Then go to `~/.ssh/config` and add the following on your local computer: |
466 | | - |
467 | | -```shell |
468 | | -Host *.trycloudflare.com |
469 | | -HostName %h |
470 | | -User user |
471 | | -Port 22 |
472 | | -ProxyCommand "cloudflared location" access ssh --hostname %h |
473 | | -``` |
474 | | - |
475 | | -3. Run `cloudflared tunnel --url ssh://localhost:22` on the remote server |
476 | | - |
477 | | -4. Finally on VS Code or any IDE that supports SSH, run `ssh user@https://your-link.trycloudflare.com` or `ssh user@your-link.trycloudflare.com` |
478 | | - |
479 | | -### Option 2: ngrok tunnel |
480 | | - |
481 | | -[](https://ngrok.com/) |
482 | | - |
483 | | -1. Make a new account for ngrok [here](https://dashboard.ngrok.com/login) |
484 | | - |
485 | | -2. Now, get the ngrok binary with `wget` and unzip it with `unzip`: |
486 | | - |
487 | | -```bash |
488 | | -wget "https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip" |
489 | | -unzip "ngrok-stable-linux-amd64.zip" |
490 | | -``` |
491 | | - |
492 | | -5. Then, go to [dashboard.ngrok.com](https://dashboard.ngrok.com) and go to the `Your Authtoken` section. |
493 | | -6. Copy the Authtoken shown there. |
494 | | -7. Now, go to the folder where you unzipped ngrok and store the Authtoken from the ngrok Dashboard. |
495 | | - |
496 | | -```bash |
497 | | -./ngrok authtoken YOUR_AUTHTOKEN # replace YOUR_AUTHTOKEN with the ngrok authtoken. |
498 | | -``` |
499 | | - |
500 | | -8. Now, forward port 22, which is the SSH port with this command: |
501 | | - |
502 | | -```bash |
503 | | -./ngrok tcp 22 |
504 | | -``` |
505 | | - |
506 | | -Now, you get a screen in the terminal like this: |
507 | | - |
508 | | -```console |
509 | | -ngrok by @inconshreveable(Ctrl+C to quit) |
510 | | - |
511 | | -Session Status online |
512 | | -Account {Your name} (Plan: Free) |
513 | | -Version 2.3.40 |
514 | | -Region United States (us) |
515 | | -Web Interface http://127.0.0.1:4040 |
516 | | -Forwarding tcp://0.tcp.ngrok.io:19028 -> localhost:22 |
517 | | -``` |
518 | | - |
519 | | -In this case, copy the forwarded link `0.tcp.ngrok.io` and remember the port number `19028`. Type this on your local Visual Studio Code: |
520 | | - |
521 | | -```bash |
522 | | -ssh user@0.tcp.ngrok.io -p 19028 |
523 | | -``` |
524 | | - |
525 | | -The port redirects you to the default SSH port 22, and you can then successfully connect to code-server by entering the password you set for the user. |
526 | | - |
527 | | -Note: the port and the url provided by ngrok will change each time you run it so modify as needed. |
0 commit comments