Skip to content

Commit 5d9680e

Browse files
authored
Merge pull request #206 from NYU-RTS/torch-ssh
ssh tweaks as discussed
2 parents a1f3ef9 + 90c3c66 commit 5d9680e

15 files changed

+64
-103
lines changed

docs/hpc/02_connecting_to_hpc/01_connecting_to_hpc.md

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,33 @@ If you'd prefer to access the HPC cluster via a web gateway instead, please refe
1212

1313
The following sections will outline basic ways to connect to the Greene cluster. Access to the clusters is primarily handled via the Secure Shell Protocol, or ssh. Below we outline ways to connect via ssh on Mac, Linux, and Windows machines.
1414

15-
## Quick Start HPC Connection Guide
16-
### Configuring Your SSH Client
17-
To connect to HPC systems, it's important to configure your machine's SSH client. For Linux and Mac machines, the configuration file is the ~/.ssh/config file on your computer. These are the basic lines that should be added to your ~/.ssh/config file:
15+
## Configuring Your SSH Client
16+
17+
To connect to HPC systems, you have to configure the SSH client on your machine. We recommend the following configuration:
1818
```sh
1919
Host greene.hpc.nyu.edu dtn.hpc.nyu.edu
20+
User <NetID>
2021
StrictHostKeyChecking no
2122
ServerAliveInterval 60
2223
ForwardAgent yes
2324
UserKnownHostsFile /dev/null
2425
LogLevel ERROR
25-
26-
Host greene
27-
HostName localhost
28-
Port 8027
29-
ForwardX11 yes
26+
27+
Host torch login.torch.hpc.nyu.edu
28+
Hostname login.torch.hpc.nyu.edu
29+
User <NetID>
3030
StrictHostKeyChecking no
31+
ServerAliveInterval 60
32+
ForwardAgent yes
3133
UserKnownHostsFile /dev/null
3234
LogLevel ERROR
33-
User <Your NetID>
3435
```
35-
### Setting Up an SSH Config File on Windows
36-
For Windows, you can now follow a similar configuration setup. Using Powershell you can use the following to create and open a Windows SSH config file:
36+
### MacOS/Linux
37+
38+
MacOS/Linux machines have SSH clients pre-installed. Using the editor of your choice, open the `~/.ssh/config` file on your machine and add the contents listed above.
39+
40+
### Windows
41+
Using Powershell you can use the following to create and open a Windows SSH config file:
3742
```sh
3843
# Create the config file with Powershell
3944
New-Item -Path $HOME\.ssh\config -ItemType File
@@ -42,12 +47,11 @@ New-Item -Path $HOME\.ssh\config -ItemType File
4247
C:\WINDOWS\System32\notepad.exe $HOME\.ssh\config
4348
```
4449
Configuring the file above will allow you to use the cmd terminal to connect to Greene.
45-
### Avoiding Man in the Middle Warning.
4650

47-
If you see this warning:
48-
49-
:::warning
51+
### Common issues
5052

53+
:::warning Man in the Middle warning
54+
If you see this warning:
5155
```sh
5256
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
5357
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@ -56,29 +60,14 @@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
5660
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
5761
It is also possible that a host key has just been changed.
5862
```
59-
63+
Do not be alarmed - this is an issue that occurs because the Greene and Torch clusters have multiple login nodes. For instance, `greene.hpc.nyu.edu` resolves to one of three possible login nodes (`log-1`, `log-2`, and `log-3`). The configuration directive `StrictHostKeyChecking no` referenced in the recommended config above will prevent this error. Ensure that you have not missed adding it.
6064
:::
6165

62-
Do not be alarmed - this is an issue that occurs because the cluster has multiple login nodes (`log-1`, `log-2`, and `log-3`) that `greene.hpc.nyu.edu` resolves to.
63-
64-
To avoid this warning, you can add these lines to your SSH configuration file. Open `~/.ssh/config` and place the following lines in it:
65-
66-
:::tip
67-
This segment, referenced in the recommended config above will nullify the error:
68-
69-
```sh
70-
Host greene.hpc.nyu.edu dtn.hpc.nyu.edu
71-
StrictHostKeyChecking no
72-
ServerAliveInterval 60
73-
ForwardAgent yes
74-
StrictHostKeyChecking no
75-
UserKnownHostsFile /dev/null
76-
LogLevel ERROR
77-
```
78-
The above will also fix SSH timeout errors by extending the `ServerAliveInterval` argument.
66+
:::info SSH Timeout errors
67+
SSH timeout errors can be fixed by extending the `ServerAliveInterval` argument.
7968
:::
8069

81-
### Connecting to the NYU Network
70+
## Connecting to the NYU Network
8271
To access the HPC systems, you must either be on the NYU secure network (such as the NYU WiFi or a wired connection from an NYU office) or use the NYU VPN.
8372

8473
:::info Connecting to the HPC clusters from outside NYU Network
@@ -110,26 +99,39 @@ With [Windowns Terminal](https://apps.microsoft.com/detail/9n0dx20hk701?hl=en-US
11099
- If you are using WSL 2 (Windows subsystem for Linux 2), you may not be able to access internet when Cisco AnyConnect VPN, installed from exe file, is activated. A potential solution: uninstall Cisco AnyConnect and install AnyConnect using Microsoft Store, and then setup new VPN connection using settings described on [IT webpage][install vpn on windows link].
111100
:::
112101

113-
## Additional Tips
114-
Below are some additional options and tips for connecting to the HPC resources.
115-
### Setting up SSH Keys
102+
## Two-factor authentication for Torch
103+
There is an extra layer of security when accessing Torch which is described below:
104+
105+
- Login as usual via the `ssh torch` command:
106+
![torch-ssh-2fa-1](static/torch-ssh-2fa-1.png)
107+
- Open [https://microsoft.com/devicelogin](https://microsoft.com/devicelogin)
108+
![torch-ssh-2fa-2](static/torch-ssh-2fa-2.png)
109+
- Copy and enter pin from terminal
110+
![torch-ssh-2fa-3](static/torch-ssh-2fa-3.png)
111+
- Enter or select your `<NetID>@nyu.edu` account
112+
![torch-ssh-2fa-4](static/torch-ssh-2fa-4.png)
113+
- Enter your password
114+
![torch-ssh-2fa-5](static/torch-ssh-2fa-5.png)
115+
- Complete MFA (click on Approve with MFA (Duo)
116+
![torch-ssh-2fa-6](static/torch-ssh-2fa-6.png)
117+
![torch-ssh-2fa-7](static/torch-ssh-2fa-7.png)
118+
![torch-ssh-2fa-8](static/torch-ssh-2fa-8.png)
119+
- Return to terminal and hit Enter
120+
![torch-ssh-2fa-9](static/torch-ssh-2fa-9.png)
121+
122+
## SSH Keys for Greene
123+
:::warning
124+
SSH keys are not supported on Torch!
125+
:::
116126

117127
Instead of typing your password every time you need to log in, you can also specify an ssh key.
118128

119129
- Only do that on the computer you trust
120-
121-
- Generate ssh key pair (terminal in Linux/Mac or cmd/WSL in Windows):
122-
[https://www.ssh.com/ssh/keygen/][ssh instructions keygen link]
123-
130+
- Generate ssh key pair (terminal in Linux/Mac or cmd/WSL in Windows): [https://www.ssh.com/ssh/keygen/][ssh instructions keygen link]
124131
- Note the path to ssh key files. Don't share key files with anybody - anybody with this key file can login to your account
125-
126132
- Log into cluster using regular login/password and then add the content of generated public key file (the one with .pub) to `$HOME/.ssh/authorized_keys` on cluster
127-
128133
- Next time you will log into cluster no password will be required
129134

130-
For additional recommendations on how to configure your SSH sessions, see the [ssh configuring and x11 forwarding page](./02_ssh_tunneling_and_x11_forwarding.md).
131-
132-
133135

134136
[nyu vpn link]: https://www.nyu.edu/life/information-technology/infrastructure/network-services/vpn.html
135137

docs/hpc/02_connecting_to_hpc/02_ssh_tunneling_and_x11_forwarding.md

Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# X11 Forwarding
2+
3+
[xquartz]: https://www.xquartz.org/
4+
5+
In rare cases when you need to interact with GUI applications on HPC clusters, you need to enable X11 forwarding for your SSH connection. Mac and Linux users will need to run the ssh commands described above with an additional flag:
6+
7+
```sh
8+
ssh -Y <NYU_NetID>@greene.hpc.nyu.edu
9+
```
10+
11+
However, Mac users need to install [XQuartz][xquartz], since X-server is no longer shipped with the macOS.
12+
13+
Windows users will also need to install X server software. We recommend using MobaXTerm. Further instructions are provided in the [introductory HPC tutorial](../12_tutorial_intro_shell_hpc/02_connecting_to_hpc.mdx).
14+
25.5 KB
Loading
269 KB
Loading
270 KB
Loading
134 KB
Loading
614 KB
Loading
162 KB
Loading
144 KB
Loading

0 commit comments

Comments
 (0)