Overview
Thenetbird login command authenticates your device with the NetBird management server without establishing network connections. Use this to authenticate before connecting with netbird up.
Description
This command performs authentication only:- Initiates SSO authentication flow (if no setup key provided)
- Validates credentials with the management server
- Stores authentication tokens locally
- Does NOT bring up the WireGuard interface
- Does NOT establish peer connections
netbird up after login to connect to the network, or use netbird up directly (which includes login if needed).
When to Use Login vs Up
Use netbird login when:
- You want to authenticate without connecting immediately
- Pre-authenticating in preparation for later connection
- Testing authentication credentials
- Separating authentication from connection in automation scripts
Use netbird up when:
- You want to authenticate AND connect in one step (most common)
- Starting NetBird for normal use
Flags
Profile name to use for the login. If not specified, the last used profile will be used.
Do not open the browser for SSO loginWhen enabled, displays the authentication URL for manual browser access. Useful for:
- Headless servers
- SSH sessions
- Automated environments
- Remote systems
--setup-key- Authenticate with a setup key instead of SSO--management-url- Specify management server URL--hostname- Set custom hostname
Examples
Interactive SSO Login
Login with SSO (opens browser):Login Without Browser (Headless)
For servers or SSH sessions:Login with Setup Key
Non-interactive authentication using a setup key:Login to Self-Hosted Management Server
Login with Custom Hostname
Login to Specific Profile
Environment Variable Authentication
Use environment variables for automation:Authentication Methods
SSO (Single Sign-On)
Default authentication method for interactive sessions: Supported SSO Providers:- Microsoft Azure AD / Entra ID
- Okta
- Auth0
- Keycloak
- Other OIDC providers
- Run
netbird login - Browser opens to SSO provider
- Login with your SSO credentials
- Browser redirects back with success message
- NetBird stores authentication token
Setup Key
Non-interactive authentication for automation:- Created in Management Dashboard
- Can be reusable or one-time use
- Can have expiration dates
- Can auto-assign to groups
- Ideal for scripting and automation
- Log into NetBird Management Dashboard
- Navigate to Setup Keys
- Click “Add Key”
- Configure key properties
- Copy the generated key
Login Flow
Daemon Mode (Default)
When the NetBird daemon is running:Foreground Mode
Without daemon (standalone authentication):Profile Management
NetBird supports multiple profiles for different networks or accounts:Login to Specific Profile
Switch Profile During Login
If currently connected, will disconnect first:Create Profile and Login
Profiles are created automatically on first login:--profile flag
Status Messages
Logging successfully- Authentication completed successfullylogin failed- Authentication failed (check credentials or setup key)failed to connect to daemon- NetBird daemon not runningNeedsSSOLogin- SSO authentication required
Common Issues
Daemon Not Running
Browser Not Opening
If browser doesn’t open automatically:- Copy the displayed URL
- Open it manually in a browser
- Complete authentication
--no-browser explicitly:
Invalid Setup Key
- Key has expired
- Key was deleted
- Key is one-time use and already consumed
- Typo in key value
Authentication Timeout
If SSO authentication times out:- Run
netbird loginagain - Complete authentication more quickly
- Check network connectivity
Session Already Exists
If already logged in:Security Considerations
Token Storage
Authentication tokens are stored securely in:- Linux:
/etc/netbird/config.json - macOS:
/etc/netbird/config.json - Windows:
%PROGRAMDATA%\Netbird\config.json
- File should be readable only by root/administrator
- Contains sensitive authentication data
- Do not share or commit to version control
Setup Key Security
Best practices:- Use one-time keys for automated provisioning
- Set expiration dates on keys
- Delete unused keys
- Use different keys for different environments
- Never commit keys to source control
- Use environment variables or secret managers
Automation Examples
Docker/Container Init
CI/CD Pipeline
Terraform/Ansible
See Also
- netbird up - Authenticate and connect
- netbird logout - Clear authentication
- netbird status - Check authentication status
- Setup Keys Guide