Skip to content

cmd/tailscale: remember SUDO_UID from "up", don't require sudo for future commands? #1684

Description

@bradfitz

On Windows, we already track the Windows userid who currently "owns" the backends.

On Linux/Unix we don't. We know the uid of the client's unix socket via https://inet.af/peercred but we require root for many actions.

But sudo sets some environment variables when run:

     SUDO_UID         Set to the user ID of the user who invoked sudo.
     SUDO_USER        Set to the login name of the user who invoked sudo.

So we could require sudo for tailscale up and then snapshot that SUDO_UID and let that userid do all commands in the future without sudo but otherwise require root the same as we do today.

/cc @danderson

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions