|
| 1 | +--- |
| 2 | +title: "Remote SSH" |
| 3 | +--- |
| 4 | + |
| 5 | +Positron has **experimental** support for Remote SSH sessions. This feature allows the Positron IDE's front end (user interface) to run on one machine, while the back end (files, projects, Python and R sessions, etc.) runs on another machine. The two machines communicate using an ordinary secure shell (SSH) connection. |
| 6 | + |
| 7 | +```{mermaid} |
| 8 | +%%| fig-align: center |
| 9 | +flowchart LR |
| 10 | +subgraph "Local Machine" |
| 11 | +p[Positron UI] |
| 12 | +end |
| 13 | +subgraph "Remote Machine" |
| 14 | +p -- SSH --> r[Positron Backend] |
| 15 | +r --> py[Python Session] |
| 16 | +r --> ark[R Session] |
| 17 | +end |
| 18 | +``` |
| 19 | + |
| 20 | +## System requirements |
| 21 | + |
| 22 | +Remote SSH sessions can be *initiated* from any operating system supported by Positron itself, including macOS, Linux, and Windows. However, the system you are *connecting* to must be running Linux using a **recent distribution**, such as Ubuntu 22+ or RedHat 9+, on an x86-compatible processor. Older Linux distributions and amd64 hosts aren't currently supported. |
| 23 | + |
| 24 | +Other features that aren't currently supported include: |
| 25 | + |
| 26 | +- Connecting to Windows Subsystem for Linux (WSL) backends |
| 27 | +- Dev Container workflows (note however that you can start a container yourself and connect to it) |
| 28 | + |
| 29 | +## Creating a connection |
| 30 | + |
| 31 | +To create a connection, open the Command Palette (<kbd>Cmd/Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd>) and type "Remote Menu". Run the _Remote SSH: Show Remote Menu_ command. |
| 32 | + |
| 33 | +{width=700} |
| 34 | + |
| 35 | +From there, run the _Connect to Host_ command. You will be prompted to enter the hostname and your credentials. |
| 36 | + |
| 37 | +If you want to avoid having to type the hostname every time, add the connection information to your user SSH config (e.g. `~/.ssh/config` on Unix-alikes). Then you can use the _Remote Explorer_ view to connect to the system again in the future. Use the _View: Show Remote Explorer_ command to open it. |
| 38 | + |
| 39 | +## Remote sessions |
| 40 | + |
| 41 | +You can identify remote SSH sessions via a small indicator in the bottom left of Positron's window. |
| 42 | + |
| 43 | +{width=350} |
| 44 | + |
| 45 | +There are some notable differences between these sessions and "regular" Positron desktop sessions. |
| 46 | + |
| 47 | +### Files |
| 48 | + |
| 49 | +Inside a remote host, the Explorer tab will show you files from the remote host instead of your local system. |
| 50 | + |
| 51 | +### Settings |
| 52 | + |
| 53 | +When connected to a remote host, you will see two different Settings; one is settings for your local machine and the other is settings that apply to the remote machine. |
| 54 | + |
| 55 | +### Extensions |
| 56 | + |
| 57 | +Most extensions run on Positron's back end. This means that the first time you connect to a remote host, you won't have any extensions installed. You'll need to reinstall any extensions on the remote host that you want to use on that host. |
| 58 | + |
| 59 | +Like the Explorer view, the Extensions view will help you see which extensions are installed locally and which are installed on the remote host. |
| 60 | + |
| 61 | +### Terminals, R, and Python |
| 62 | + |
| 63 | +All Terminals as well as your R and Python sessions will run on the remote host. |
| 64 | + |
| 65 | +### Port forwarding |
| 66 | + |
| 67 | +When you run web applications (e.g. Shiny applications) in Positron, Positron automatically maps the port on the remote host to a port on your local machine. |
| 68 | + |
| 69 | +For example, note that this Shiny application running on `:6868` automatically gets a forwarded port `6868` on the local host. The _Ports_ tab shows which ports are currently forwarded from the remote to the local host. Positron tries to use the same port on both hosts when it's available. |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | +## How it works & troubleshooting |
| 74 | + |
| 75 | +When Positron connects to a new host for the first time, it does the following: |
| 76 | + |
| 77 | +1. Establishes an SSH connection to the host. |
| 78 | +2. Forms the name and download URL of the correct Positron Server binary, e.g. `positron-reh-linux-x64-2025.01.0-39.tar.gz` |
| 79 | +3. On the remote host, downloads this binary into `~/.positron-server` and unpacks it. |
| 80 | +4. Starts the headless Positron Server inside the remote host. |
| 81 | +5. Connects to the server from the front end. |
| 82 | + |
| 83 | +The two most common problems are: |
| 84 | + |
| 85 | +- Encountering a 404 when downloading the Positron Server binary. This happens when you attempt to use Remote SSH against a host type that's not supported, for example, connecting to a macOS host. |
| 86 | +- Encountering an error when starting the Positron Server binary. This happens when you attempt to use Remote SSH against a version of Linux that's not supported by Positron. |
| 87 | + |
| 88 | +If you need to use a different URL to download Positron Server (for example to use a local copy due to network constraints, or to force the use of a particular version even if it's not autodetected), you can edit this setting: |
| 89 | + |
| 90 | +{width=650} |
| 91 | + |
| 92 | +Note that the client and server must be using **exactly** the same Positron version. |
0 commit comments