Skip to content

Commit ad3e8b6

Browse files
committed
VSCode SSH first draft
1 parent bc344f7 commit ad3e8b6

14 files changed

+143
-0
lines changed

docs/images/remotessh_00.png

619 KB
Loading

docs/images/remotessh_01.png

174 KB
Loading

docs/images/remotessh_02.png

497 KB
Loading

docs/images/remotessh_03.png

441 KB
Loading

docs/images/remotessh_04.png

144 KB
Loading

docs/images/remotessh_05.png

86.2 KB
Loading

docs/images/remotessh_06.png

116 KB
Loading

docs/images/remotessh_07.png

66.8 KB
Loading

docs/images/remotessh_08.png

448 KB
Loading

docs/images/remotessh_09.png

146 KB
Loading

docs/images/remotessh_10.png

708 KB
Loading

docs/images/remotessh_11.png

438 KB
Loading

docs/index.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,15 @@ <h1 style="border-bottom: 1px solid var(--main-header-border-bottom-color, #eaec
290290
UMich CoE Linux environment
291291
</div>
292292
</div>
293+
<div class="item">
294+
<a class="header" target="_blank" href="setup_remotessh.html">
295+
<i class="icon satellite dish"></i>VSCode CAEN Access
296+
</a>
297+
<div class="description">
298+
Develop and test directly on CAEN
299+
using VSCode
300+
</div>
301+
</div>
293302
</div>
294303

295304
</div>

docs/setup_remotessh.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
---
2+
layout: spec
3+
title: Setup VSCode CAEN Access
4+
---
5+
6+
VSCode CAEN Access
7+
==========
8+
{: .primer-spec-toc-ignore }
9+
10+
This tutorial will show you how to set up VSCode access into CAEN Linux via SSH. It allows you to remotely edit and execute files as if you were using VSCode on the CAEN computers themselves. This may come in handy for those who wish to develop and test their projects directly on CAEN.
11+
12+
13+
## Prerequisites
14+
If you haven't already, follow the [CAEN Linux Tutorial](setup_caen.html) so your CAEN environment is ready for VSCode to access. If you need a refresher on VScode, read through the [tutorial](setup_vscode.html).
15+
16+
17+
<div class="primer-spec-callout warning" markdown="1">
18+
**Pitfall:** If you are off campus, make sure you have connected to the [UM VPN](https://its.umich.edu/enterprise/wifi-networks/vpn/getting-started) before continuing.
19+
</div>
20+
21+
## Setup Remote SSH Extension
22+
23+
### Edit SSH Config
24+
First, we need to specify CAEN as a host in our SSH config file so VSCode knows where to connect. You can find the file at `~/.ssh/config`.
25+
26+
Add the following lines to the SSH config file, replacing `<uniqname>` with your own uniqname.
27+
```
28+
Host caen #(Can be named anything you like)
29+
HostName login.engin.umich.edu
30+
User <uniqname>
31+
```
32+
33+
Verify the contents of your `~/.ssh/config` file.
34+
```console
35+
$ cat ~/.ssh/config
36+
# SSH multiplexing (from CAEN Linux Tutorial)
37+
Host *
38+
ControlMaster auto
39+
ControlPersist yes
40+
ControlPath ~/.ssh/socket-%C
41+
ServerAliveInterval 60
42+
ServerAliveCountMax 5
43+
44+
Host caen
45+
HostName login.engin.umich.edu
46+
User armaanr
47+
```
48+
49+
<div class="primer-spec-callout info" markdown="1">
50+
**Pro-tip:** Adding hosts in this manner also gives you an easy way to SSH without needing to remember the hostname. For example:
51+
```console
52+
$ ssh caen
53+
([email protected]) Password:
54+
```
55+
</div>
56+
57+
### Install Extension
58+
Open up VSCode and install the [Remote - SSH Extension](https://aka.ms/vscode-remote/download/ssh).
59+
60+
<img src="images/remotessh_00.png" width="768px" />
61+
62+
### Modify Extension Settings
63+
In its default configuration, the extension doesn't play nicely with the CAEN computers. So, we need to modify some settings first.
64+
65+
Open the command palette by pressing <kbd>Command</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> on Mac or <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> on Windows/Linux. Search for "Remote SSH settings" and click on the option.
66+
67+
<img src="images/remotessh_01.png" width="768px" />
68+
69+
70+
Search for "Exec Server" and disable the "Use Exec Server" option.
71+
72+
<img src="images/remotessh_02.png" width="768px" />
73+
74+
Search for "Flock" and disable the "Use Flock" option.
75+
76+
<img src="images/remotessh_11.png" width="768px" />
77+
78+
79+
## Connect to CAEN
80+
### Connect
81+
Click the remote connection button on the bottom right and then click the "Connect to Host..." option.
82+
83+
<img src="images/remotessh_03.png" width="768px" />
84+
85+
Click on the "caen" option (this is the SSH host that we set up [earlier](#edit-ssh-config)).
86+
87+
<div class="primer-spec-callout info" markdown="1">
88+
If in the future you want to connect to some other host, you can manually specify `user@host` in this box too (e.g. `[email protected]`).
89+
</div>
90+
91+
<img src="images/remotessh_04.png" width="768px" />
92+
93+
Finally, you will be prompted for your CAEN password and Duo 2FA. The Duo 2FA prompt may be cut off. You can hover your mouse over the box and the full prompt will be shown.
94+
95+
<img src="images/remotessh_05.png" width="768px" />
96+
<img src="images/remotessh_06.png" width="768px" />
97+
98+
Now, the button in the bottom left should say "SSH: caen" (or whatever host you specified earlier).
99+
100+
<img src="images/remotessh_07.png" width="768px" />
101+
102+
103+
### Open Workspace
104+
Now you can open a folder from your CAEN home directory as a workspace.
105+
106+
<img src="images/remotessh_08.png" width="768px" />
107+
108+
Browse to your chosen directory and click "OK".
109+
110+
<img src="images/remotessh_09.png" width="768px" />
111+
112+
Now you should be able to work on CAEN!
113+
114+
<img src="images/remotessh_10.png" width="768px" />
115+
116+
117+
118+
## Troubleshooting
119+
If you are suddenly unable to connect, you can try deleting the VSCode server files. Sometimes the files that VSCode drops onto the remote host don't get cleaned up properly and it tries to reuse an unreachable remote server. SSH into CAEN normally and execute the following:
120+
121+
```console
122+
123+
...
124+
$ mv ~/.vscode-server ~/.vscode-old
125+
$ rm -rf ~/.vscode-old
126+
```
127+
128+
Restart VSCode on your own computer and [try again](#connect-to-caen).
129+
130+
131+
## Acknowledgments
132+
Original tutorial written by Anish Nyayachavadi for EECS 491.
133+
134+
This document is licensed under a [Creative Commons Attribution-NonCommercial 4.0 License](https://creativecommons.org/licenses/by-nc/4.0/). You’re free to copy and share this document, but not to sell it. You may not share source code provided with this document.

0 commit comments

Comments
 (0)