Skip to content

Commit faa384c

Browse files
authored
Merge pull request #7942 from microsoft/portable-mode
Include instructions for Linux sandboxing
2 parents 8b5dfb2 + a7caa11 commit faa384c

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

docs/editor/portable.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ TOCTitle: Portable Mode
55
ContentId: A5C839C4-67E9-449C-94B8-4B310FCAAB1B
66
PageTitle: Portable Mode in Visual Studio Code
77
DateApproved: 12/11/2024
8-
MetaDescription: Visual Studio Code supports a Portable Mode.
8+
MetaDescription: Visual Studio Code supports a Portable mode that enables moving your installation and related data to a different location.
99
---
10-
# Portable Mode
10+
# Portable mode
1111

1212
Visual Studio Code supports [Portable mode](https://en.wikipedia.org/wiki/Portable_application). This mode enables all data created and maintained by VS Code to live near itself, so it can be moved around across environments.
1313

1414
This mode also provides a way to set the installation folder location for VS Code extensions, useful for corporate environments that prevent extensions from being installed in the Windows AppData folder.
1515

1616
Portable mode is supported on the ZIP download for Windows, and the TAR.GZ download for Linux, as well as the regular Application download for macOS. See the [Download page](/download) to find the correct `.zip / .tar.gz` file for your platform.
1717

18-
> **Note:** Do not attempt to configure portable mode on an installation from the **Windows User or System installers**. Portable mode is only supported on the Windows ZIP (`.zip`) archive. Note as well that the Windows ZIP archive does not support auto update.
18+
> [!IMPORTANT]
19+
> Do not attempt to configure portable mode on an installation from the **Windows User or System installers**. Portable mode is only supported on the Windows ZIP (`.zip`) archive. Note also that the Windows ZIP archive does not support auto update.
1920
2021
## Enable Portable mode
2122

@@ -35,10 +36,24 @@ After unzipping the VS Code download, create a `data` folder within VS Code's fo
3536

3637
From then on, the `data` folder will be used to contain all VS Code data, including session state, preferences, extensions, etc.
3738

38-
>**Note**: The `data` folder will override the `--user-data-dir` and `--extensions-dir` [command line](/docs/editor/command-line.md#advanced-cli-options) options.
39+
> [!NOTE]
40+
> The `data` folder will override the `--user-data-dir` and `--extensions-dir` [command line](/docs/editor/command-line.md#advanced-cli-options) options.
3941
4042
The `data` folder can be moved to other VS Code installations. This is useful for updating your portable VS Code version, in which case you can move the `data` folder to a newer extracted version of VS Code.
4143

44+
### Linux
45+
46+
On **Linux**, in addition to creating the `data` folder, you also need to set the correct [Electron sandbox](https://www.electronjs.org/docs/tutorial/sandbox) permissions.
47+
48+
Chromium has a [multi-layer sandboxing model on Linux](https://chromium.googlesource.com/chromium/src/+/0e94f26e8/docs/linux_sandboxing.md). If Chromium cannot use the namespace sandbox for layer-1, it will try to use the [`setuid` sandbox](https://chromium.googlesource.com/chromium/src/+/0e94f26e8/docs/linux_suid_sandbox.md) via the helper binary `chrome-sandbox` that is shipped alongside the application binary.
49+
50+
Run the following commands to set the correct permissions of the `setuid` helper:
51+
52+
```bash
53+
sudo chown root <path-to-vscode>/chrome-sandbox
54+
sudo chmod 4755 <path-to-vscode>/chrome-sandbox
55+
```
56+
4257
### macOS
4358

4459
On **macOS**, you need to place the data folder as a sibling of the application itself. Since the folder will be alongside the application, you need to name it specifically so that VS Code can find it. The default folder name is `code-portable-data`:
@@ -54,7 +69,8 @@ Portable Mode won't work if your application is in [quarantine](https://apple.st
5469
xattr -dr com.apple.quarantine Visual\ Studio\ Code.app
5570
```
5671

57-
**Note:** On Insiders, the folder should be named `code-insiders-portable-data`.
72+
> [!NOTE]
73+
> On Insiders, the folder should be named `code-insiders-portable-data`.
5874
5975
## Update Portable VS Code
6076

release-notes/v1_59.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ In this milestone, we finished the exploration to bundle Electron 13 into VS Cod
477477

478478
### Progress for Electron sandbox support
479479

480-
As we continue to make the VS Code workbench ready for enabling Electron's [sandbox](https://www.electronjs.org/docs/tutorial/sandbox), we wanted to enable mixed sandbox mode on Linux and no longer bundle with the CLI argument `--no-sandbox` in our distributed packages deb, rpm, snap and tar archive. Chromium has a [multi-layer sandboxing model on Linux](https://chromium.googlesource.com/chromium/src/+/HEAD/docs/linux/sandboxing.md). If Chromium cannot use the namespace sandbox for layer-1, it will try to use the [setuid sandbox](https://chromium.googlesource.com/chromium/src/+/HEAD/docs/linux/suid_sandbox.md) via the helper binary `chrome-sandbox` shipped alongside the application binary. For the setuid binary to work, it needs to meet the following conditions:
480+
As we continue to make the VS Code workbench ready for enabling Electron's [sandbox](https://www.electronjs.org/docs/tutorial/sandbox), we wanted to enable mixed sandbox mode on Linux and no longer bundle with the CLI argument `--no-sandbox` in our distributed packages deb, rpm, snap and tar archive. Chromium has a [multi-layer sandboxing model on Linux](https://chromium.googlesource.com/chromium/src/+/0e94f26e8/docs/linux_sandboxing.md). If Chromium cannot use the namespace sandbox for layer-1, it will try to use the [`setuid` sandbox](https://chromium.googlesource.com/chromium/src/+/0e94f26e8/docs/linux_suid_sandbox.md) via the helper binary `chrome-sandbox` that is shipped alongside the application binary. For the `setuid` binary to work, it needs to meet the following conditions:
481481

482482
* The sandbox binary must be executable by the Chromium process.
483483
* It must be SUID and executable by others.
@@ -492,7 +492,7 @@ FATAL:setuid_sandbox_host.cc(158)] The SUID sandbox helper binary was found, but
492492

493493
If that happens, you can use either of the following two options to get it working:
494494

495-
* Fix the permissions of setuid helper
495+
* Fix the permissions of `setuid` helper
496496

497497
```bash
498498
sudo chown root <path-to-vscode>/chrome-sandbox

0 commit comments

Comments
 (0)