Skip to content

Commit c6187fb

Browse files
authored
Switching Between NetBird Accounts with Profiles
1 parent 9eb5da7 commit c6187fb

File tree

4 files changed

+206
-0
lines changed

4 files changed

+206
-0
lines changed
80.9 KB
Loading
2.64 MB
Loading
160 KB
Loading

src/pages/how-to/profiles.mdx

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
# Switching Between NetBird Accounts with Profiles
2+
3+
NetBird supports multiple profiles on a single device, making it easy to switch between work, home, or other networks.
4+
Only one profile is active at a time, and switching takes just a click.
5+
6+
This feature also allows you to switch between self-hosted and cloud-hosted NetBird accounts seamlessly without needing
7+
to juggle multiple config files.
8+
9+
<p>
10+
<img src="/docs-static/img/how-to-guides/profiles/profiles.png" alt="profiles" className="imagewrapper"/>
11+
</p>
12+
13+
Watch a short demo GIF demonstrating how profile switching works [here](/docs-static/img/how-to-guides/profiles/profiles.gif).
14+
15+
## NetBird Profiles GUI Quickstart
16+
17+
To get started with NetBird profiles:
18+
19+
- Upgrade your client application to the latest NetBird version.
20+
- Run the GUI app
21+
22+
You will see a `default` profile created automatically.
23+
24+
Add more profiles by hovering over the default profile and clicking "Manage Profiles".
25+
After adding a new profile, select it to make it active.
26+
27+
You can now change the NetBird settings, e.g., providing a self-hosted
28+
instance URL or allowing SSH. The new settings will be saved in the new profile. Click "Connect" to bring up the new profile.
29+
30+
The consequent selection of your profiles from the menu will automatically trigger the NetBird client to connect to the network and authentication
31+
if needed.
32+
33+
## Manage Profiles in the GUI
34+
35+
* **Add** a new profile with a friendly name input.
36+
* **Delete** any inactive profile (trash icon).
37+
* **Active and default** profiles cannot be removed.
38+
39+
<p>
40+
<img src="/docs-static/img/how-to-guides/profiles/manage-profiles.png" alt="profiles" className="imagewrapper"/>
41+
</p>
42+
43+
## What Is a Profile?
44+
45+
A **profile** is your NetBird configuration bundle: WireGuard keys, login state, and network settings all in one file.
46+
Think of it as a separate "NetBird account" on your machine:
47+
48+
- **Default profile**
49+
Created automatically on first run or after upgrade.
50+
- **Custom profiles**
51+
Any number of additional profiles you add yourself (e.g. `work`, `home`, `test`).
52+
53+
Profiles live in your system or user config folders:
54+
55+
| OS | System-wide path | User path |
56+
| ------ | --------------------------------- | ----------------------------------------------------- |
57+
| Linux | `/var/lib/netbird/profiles/...` | `~/.config/netbird/<profile>.json` |
58+
| macOS | `/Library/Application Support/...`| `~/Library/Application Support/NetBird/<profile>.json`|
59+
| Windows| `%ProgramData%\Netbird\profiles\` | `%APPDATA%\Netbird\<profile>.json` |
60+
61+
---
62+
63+
## Why Use Profiles?
64+
65+
- **Seamless switching** between multiple NetBird networks/accounts
66+
- **No manual config files updates**: all configs are managed through the CLI or GUI
67+
- **Persistent state**: your last active profile reconnects on startup
68+
- **Safe defaults**: you cannot remove the active/default profile by accident
69+
70+
---
71+
72+
## Upgrading From an Older Version
73+
74+
If you're upgrading from NetBird below version `0.52.0` that did not support profiles, here's what happens:
75+
76+
* During the first launch after the upgrade, your existing config `/etc/netbird/config.json` (or Windows equivalent) is automatically
77+
copied to a new profile named `default`.
78+
* The `default` profile is set as active, and you can start using it immediately.
79+
80+
---
81+
82+
## Profile CLI Commands
83+
84+
With the CLI, you can manage profiles easily. The main command is:
85+
86+
```bash
87+
netbird profile <add|list|select|remove> [name]
88+
````
89+
90+
### Add a New Profile
91+
92+
To create a new profile, use the command:
93+
94+
```bash
95+
netbird profile add <PROFILE_NAME>
96+
```
97+
98+
For example, the command below creates a new profile named `work`:
99+
100+
```bash
101+
netbird profile add work
102+
```
103+
104+
This command does the following in the background:
105+
106+
* Creates a `work.json` file in your config folder.
107+
* Keeps the client disconnected until you run `netbird up` or `netbird login`.
108+
* Will throw an error if the profile with the same name already exists.
109+
110+
### List Profiles
111+
112+
The command below lists all available profiles along with their status:
113+
114+
```bash
115+
netbird profile list
116+
```
117+
118+
For example, running this command might output:
119+
120+
```text
121+
Found 3 profiles:
122+
✓ work
123+
✗ default
124+
✗ home
125+
```
126+
127+
* **** = active
128+
* **** = inactive
129+
130+
### Select (Switch) a Profile
131+
132+
To switch to a specific profile, use:
133+
134+
```bash
135+
netbird profile select <PROFILE_NAME>
136+
```
137+
138+
For example, to switch to the `home` profile:
139+
140+
```bash
141+
netbird profile select home
142+
```
143+
144+
The successful command will output:
145+
146+
```text
147+
Profile switched successfully to: home
148+
```
149+
150+
If `home` hasn't been used before, you will need to run `netbird up` or `netbird login` to authenticate.
151+
If the profile does not exist, you'll see an error message:
152+
153+
```text
154+
Error: profile home does not exist
155+
```
156+
157+
### Remove a Profile
158+
159+
To remove a profile, use:
160+
161+
```bash
162+
netbird profile remove <PROFILE_NAME>
163+
```
164+
165+
For example, to remove the `home` profile:
166+
167+
```bash
168+
netbird profile remove home
169+
```
170+
171+
If successful, you'll see:
172+
173+
```text
174+
Profile removed successfully: home
175+
```
176+
177+
You can't remove an active profile. If the profile your are trying to remove is active, you'll see an error:
178+
179+
```text
180+
Cannot remove active profile: home
181+
```
182+
183+
If the profile does not exist, you'll see an error message:
184+
185+
```text
186+
Error: profile home does not exist
187+
```
188+
189+
The command does the following in the background:
190+
191+
* Removes `home.json` and `home.state.json` files from your config folder.
192+
193+
---
194+
195+
### Using `--profile` Flags
196+
197+
You can use the `--profile` flag with any NetBird CLI command to specify which profile to use for that command.
198+
This is useful for running commands in a specific context without switching profiles manually.
199+
200+
```bash
201+
netbird up --profile work
202+
netbird login --profile home
203+
```
204+
205+
NetBird switches to the named profile then runs the command under the hood. If the profile is new and hasn't been used yet,
206+
you'll be prompted to authenticate.

0 commit comments

Comments
 (0)