|
1 | 1 | ---
|
2 | 2 | id: connect-via-ssh
|
3 |
| -title: Connect to Nebari via SSH or SFTP |
| 3 | +title: Connect to Nebari's JupyterLab via SSH or SFTP |
4 | 4 | description: Set up a remote SSH connection using jupyter-ssh
|
5 | 5 | ---
|
6 | 6 |
|
7 |
| -# Connect to Nebari via SSH or SFTP |
| 7 | +# Connect to Nebari's JupyterLab via SSH or SFTP |
8 | 8 |
|
9 |
| -Secure Shell Protocol (SSH) is a standard protocol for communicating securely over a network connection. Secure File Transfer Protocol (SFTP) is based on SSH and transfers files to and from a remote machine. In this guide, you will learn how to connect and launch your JupyterLab user instance via SSH and transfer files using SFTP from your local machine. |
| 9 | +Secure Shell Protocol (SSH) is a standard protocol for communicating securely over a network connection. Secure File Transfer Protocol (SFTP) is based on SSH and transfers files to and from a remote machine. In this guide, you will learn how to connect and launch your JupyterLab user instance via SSH and transfer files using SFTP from your local machine. |
10 | 10 |
|
11 |
| -Nebari includes a package called [`jupyterhub-ssh`](https://github.com/yuvipanda/jupyterhub-ssh) in all deployments to allow remote connection to their user instances. On Nebari, SSH connections are set up on port 8022 and SFTP connections on port 8023. |
| 11 | +Nebari includes a package called [`jupyterhub-ssh`](https://github.com/yuvipanda/jupyterhub-ssh) in all deployments to allow remote connection to their user instances. On Nebari, SSH connections are set up on port 8022 and SFTP connections on port 8023. |
| 12 | + |
| 13 | +:::note |
| 14 | +There is a distinction between the Nebari and JupyterHub servers, though these are easily conflated by end users. |
| 15 | +Nebari itself is generally accessed via [kubectl](/how-tos/debug-nebari#installing-kubectl) |
| 16 | +to connect directly to the cluster (nodes or pods), while the JupyterHub server runs _on_ Nebari and controls the spawning of |
| 17 | +user instances of JupyterLab. The approach described here uses a JupyterHub plugin, `jupyterhub-ssh`, to spawn and access users' JupyterLab instance |
| 18 | +::: |
12 | 19 |
|
13 | 20 | ## Prepare for the connection on the Nebari deployment
|
14 | 21 |
|
15 |
| -You will create a JupyterHub _token_ in order to access your server remotely. To do this, log into your Nebari deployment and navigate to the JupyterHub token page, \<your-nebari-domain.org/hub/token\>. |
| 22 | +You will create a JupyterHub _token_ in order to access your server remotely. To do this, log into your Nebari deployment and navigate to the JupyterHub token page, <your-nebari-domain.org/hub/token>. |
16 | 23 |
|
17 | 24 | This page is also accessible via the Nebari Home Page:
|
18 | 25 |
|
19 |
| -* If your deployment has `jhub-apps` enabled, you can navigate to this page by selecting the `Token` option under your username in the upper righthand corner. |
20 |
| -* If your deployment does not have `jhub-apps` enabled, you can click on the `Token` link on the top navigation bar. |
| 26 | +- If your deployment has `jhub-apps` enabled, you can navigate to this page by selecting the `Token` option under your username in the upper righthand corner. |
| 27 | +- If your deployment does not have `jhub-apps` enabled, you can click on the `Token` link on the top navigation bar. |
21 | 28 |
|
22 | 29 | You may add a note and expiration date to the token. You can leave the scopes field blank to give the token all the permissions that your user typically has on JupyterHub (which is the service on which Nebari is running).
|
23 | 30 |
|
24 | 31 | ## Connect to Nebari via SSH
|
25 | 32 |
|
26 |
| -Before you being, you'll need to have SSH installed on your local machine. From a terminal, use `ssh` to begin the connection. |
| 33 | +Before you being, you'll need to have SSH installed on your local machine. From a terminal, use `ssh` to begin the connection. |
27 | 34 |
|
28 |
| -`ssh \<your-nebari-domain.com\> -l \<your-username\> -p 8022` |
| 35 | +`ssh <your-nebari-domain.com> -l <your-username> -p 8022` |
29 | 36 |
|
30 |
| -:::note |
31 |
| -The syntax for `\<your-nebari-domain.com\>` is important - do not include `https://` or a trailing `/`. |
| 37 | +:::important |
| 38 | +The syntax for `<your-nebari-domain.com>` is important - do not include `https://` or a trailing `/`. |
| 39 | + |
| 40 | +If you have the incorrect syntax, it will result in the error: |
32 | 41 |
|
33 |
| -If you have the incorrect syntax, it will result in the error: `Could not resolve hostname \<your-nebari-domain.com\>: nodename nor servname provided, or not known` |
| 42 | +`Could not resolve hostname <your-nebari-domain.com>: nodename nor servname provided, or not known` |
34 | 43 | :::
|
35 | 44 |
|
36 |
| -You will then be prompted for your password. Enter the token as the password and press `Enter`. |
| 45 | +You will then be prompted for your password. Enter the token as the password and press `Enter`. |
37 | 46 |
|
38 | 47 | If you don't already have a JupyterLab server running on your Nebari instance, it may take several minutes for the server to start up. The `ssh` connection has it's own timeout period which is likely shorter than the time it takes to spinup a new server. Therefore, you may see the following error as the `ssh` connection times out:
|
39 | 48 |
|
40 | 49 | `Starting your server............................................failed to start server on time!`
|
41 | 50 |
|
42 |
| -The good news is that Nebari is still working on spinning up your server. Retry the `ssh` connection until the connection is established once the server is up and accessible. |
| 51 | +The good news is that Nebari is still working on spinning up your server. Retry the `ssh` connection until the connection is established once the server is up and accessible. |
43 | 52 |
|
44 | 53 | Once the connection is complete, you will have terminal access to your JupyterLab instance on Nebari.
|
45 | 54 |
|
46 | 55 | ## Use SFTP to transfer files to/from Nebari
|
47 | 56 |
|
48 |
| -SFTP, which stands for _Secure File Transfer Protocol_, is a protocol built into SSH that can implement file transfer commands over a secure connection. The SFTP port on Nebari is 8023. |
| 57 | +SFTP, which stands for _Secure File Transfer Protocol_, is a protocol built into SSH that can implement file transfer commands over a secure connection. The SFTP port on Nebari is 8023. |
49 | 58 |
|
50 |
| -Utilizing SFTP will depend on how your local machine is configured and the utility you're using for SFTP. In some cases, your SSH configuration will allow SFTP to work "out of the box". Other times, special SFTP setup is required in your SSH configuration to allow for these connections. |
| 59 | +Utilizing SFTP will depend on how your local machine is configured and the utility you're using for SFTP. In some cases, your SSH configuration will allow SFTP to work "out of the box". Other times, special SFTP setup is required in your SSH configuration to allow for these connections. |
51 | 60 |
|
52 | 61 | ## Dangerous, but useful information
|
53 | 62 |
|
54 | 63 | :::warning
|
55 |
| -The following suggestion is not recommended unless absolutely necessary since it will artificially keep a JupyterLab instance running which may have financial repercussions. |
| 64 | +The following suggestion is not recommended unless absolutely necessary since it will artificially keep a JupyterLab instance running which may have financial repercussions. |
56 | 65 | :::
|
57 | 66 |
|
58 |
| -If you have a long-running task and you need to avoid the idle-culler on JupyterLab, you can use [tmux](https://github.com/tmux/tmux/wiki) to keep your server alive while your task is completing. |
| 67 | +If you have a long-running task and you need to avoid the idle-culler on JupyterLab, you can use [tmux](https://github.com/tmux/tmux/wiki) to keep your server alive while your task is completing. |
59 | 68 |
|
60 | 69 | Short list of useful commands:
|
| 70 | + |
61 | 71 | - Create a new session `tmux new -s mysession`
|
62 | 72 | - Detach from session <kbd>ctrl</kbd> + <kbd>b</kbd> <kbd>d</kbd>
|
63 | 73 | - List available session `tmux ls`
|
|
0 commit comments