I have dug around a bit in the manpages: As for the error itself:
,---- | NAME | setsid - creates a session and sets the process group ID | | [...] | | ERRORS | | EPERM | The process group ID of any process equals the PID of | the calling process. Thus, in particular, setsid() | fails if the calling process is already a process group | leader. `---- I suppose that this is exactly the case because of use_pty. ,---- | NAME | sudoers — default sudo security policy plugin | | [...] | | use_pty If set, and sudo is running in a terminal, the command | will be run in a pseudo-terminal (even if no I/O log‐ | ging is being done). If the sudo process is not at‐ | tached to a terminal, use_pty has no effect. `---- So is there a way to prevent ssh from allocating a terminal? Turns out there is: ,---- | NAME | ssh — OpenSSH remote login client | | [...] | | -T Disable pseudo-terminal allocation. `---- I suppose that patching sshuttle to call ssh with that parameter might work. Cheers, -Hilko