[GH-ISSUE #5345] netbird ssh fails in unprivileged LXC/Incus containers: setsid: failed to set the controlling terminal: Operation not permitted #11299

Open
opened 2026-08-05 01:29:12 -04:00 by saavagebueno · 8 comments
Owner

Originally created by @pieterhollander on GitHub (Feb 16, 2026).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/5345

Describe the problem

netbird ssh fails immediately after authentication when the target peer runs inside an unprivileged LXC/Incus container. The session authenticates successfully but drops with:

setsid: failed to set the controlling terminal: Operation not permitted

When util-linux login is detected, getLinuxLoginCmd() in client/ssh/server/userswitching_unix.go wraps the login command with setsid -w -c. The -c (--ctty) flag calls the TIOCSCTTY ioctl to set the controlling terminal, which is blocked by the default seccomp profile in unprivileged LXC/Incus containers.

The code already has a TODO acknowledging this:

// TODO: handle this via the executor using syscall.Setsid() + TIOCSCTTY + syscall.Exec()
// to avoid external setsid dependency.

To Reproduce

  1. Create an unprivileged Incus (or LXC) container
  2. Install and connect NetBird with --allow-server-ssh
  3. From another peer, run netbird ssh user@target
  4. Authentication succeeds, then connection drops immediately

Workaround: set security.privileged=true on the container, which defeats the purpose of using unprivileged containers.

Expected behavior

netbird ssh to unprivileged Incus / LXC containers should be possible, and in that sense be able to work just like openssh-server does.

Are you using NetBird Cloud?

No

NetBird version

0.65.1

Originally created by @pieterhollander on GitHub (Feb 16, 2026). Original GitHub issue: https://github.com/netbirdio/netbird/issues/5345 **Describe the problem** `netbird ssh` fails immediately after authentication when the target peer runs inside an unprivileged LXC/Incus container. The session authenticates successfully but drops with: ``` setsid: failed to set the controlling terminal: Operation not permitted ``` When util-linux `login` is detected, `getLinuxLoginCmd()` in `client/ssh/server/userswitching_unix.go` wraps the login command with `setsid -w -c`. The `-c` (`--ctty`) flag calls the `TIOCSCTTY` ioctl to set the controlling terminal, which is blocked by the default seccomp profile in unprivileged LXC/Incus containers. The code already has a TODO acknowledging this: ```go // TODO: handle this via the executor using syscall.Setsid() + TIOCSCTTY + syscall.Exec() // to avoid external setsid dependency. ``` **To Reproduce** 1. Create an unprivileged Incus (or LXC) container 2. Install and connect NetBird with `--allow-server-ssh` 3. From another peer, run `netbird ssh user@target` 4. Authentication succeeds, then connection drops immediately Workaround: set `security.privileged=true` on the container, which defeats the purpose of using unprivileged containers. **Expected behavior** `netbird ssh` to unprivileged Incus / LXC containers should be possible, and in that sense be able to work just like `openssh-server` does. **Are you using NetBird Cloud?** No **NetBird version** 0.65.1
saavagebueno added the triage-needed label 2026-08-05 01:29:12 -04:00
Author
Owner

@dezfutak commented on GitHub (Feb 17, 2026):

Out of interest - is this on a Ubuntu 24.04 server? Reason for wondering this is to do with the way ssh is now handled via systemd in U2404 (just thought that perhaps that was "triggering" the issue. No idea if true, as I've not tested netbird in incus yet)

<!-- gh-comment-id:3916967497 --> @dezfutak commented on GitHub (Feb 17, 2026): Out of interest - is this on a Ubuntu 24.04 server? Reason for wondering this is to do with the way ssh is now handled via systemd in U2404 (just thought that perhaps that was "triggering" the issue. No idea if true, as I've not tested netbird in incus yet)
Author
Owner

@pieterhollander commented on GitHub (Feb 17, 2026):

@dezfutak The host as well as instance are running Debian Trixie

<!-- gh-comment-id:3917321349 --> @pieterhollander commented on GitHub (Feb 17, 2026): @dezfutak The host as well as instance are running Debian Trixie
Author
Owner

@dezfutak commented on GitHub (Feb 17, 2026):

@dezfutak The host as well as instance are running Debian Trixie

Ah, ok - sometimes Ubuntu can be a pain, so at least we know it's definitely not the distro itself :)

<!-- gh-comment-id:3917437839 --> @dezfutak commented on GitHub (Feb 17, 2026): > [@dezfutak](https://github.com/dezfutak) The host as well as instance are running Debian Trixie Ah, ok - sometimes Ubuntu can be a pain, so at least we know it's definitely not the distro itself :)
Author
Owner

@crntnvdl commented on GitHub (Apr 27, 2026):

Is there still work to do on the PR ?

<!-- gh-comment-id:4325681355 --> @crntnvdl commented on GitHub (Apr 27, 2026): Is there still work to do on the PR ?
Author
Owner

@pieterhollander commented on GitHub (Apr 28, 2026):

Nope, not on the code. Perhaps the code could be tested out by more people on more systems before getting merged, but I'm really just waiting on a review from the maintainers.

<!-- gh-comment-id:4333764705 --> @pieterhollander commented on GitHub (Apr 28, 2026): Nope, not on the code. Perhaps the code could be tested out by more people on more systems before getting merged, but I'm really just waiting on a review from the maintainers.
Author
Owner

@renne commented on GitHub (May 2, 2026):

Still happens on Debian 13 unprivileged LXC container in version 0.70.4.

<!-- gh-comment-id:4364943057 --> @renne commented on GitHub (May 2, 2026): Still happens on Debian 13 unprivileged LXC container in version 0.70.4.
Author
Owner

@pieterhollander commented on GitHub (May 3, 2026):

@renne That's correct, as #5382 hasn't been merged yet.

<!-- gh-comment-id:4366243482 --> @pieterhollander commented on GitHub (May 3, 2026): @renne That's correct, as #5382 hasn't been merged yet.
Author
Owner

@renne commented on GitHub (Aug 3, 2026):

Proxmox Virtual Environment (all versions including newest 9.2.6) does not allow to convert an un-privileged container into a privileged one. This means a container has to be re-installed as privileged for Netbird client to work. In my case the unprivileged container is Debian 13.
Netbird 0.76.0 still has this bug.

<!-- gh-comment-id:5166372824 --> @renne commented on GitHub (Aug 3, 2026): Proxmox Virtual Environment (all versions including newest 9.2.6) does not allow to convert an un-privileged container into a privileged one. This means a container has to be re-installed as privileged for Netbird client to work. In my case the unprivileged container is Debian 13. Netbird 0.76.0 still has this bug.
Sign in to join this conversation.
No Label triage-needed
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#11299