Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remoteUser in devcontainer.json doesn't work in corporate environment #2957

Closed
clssn opened this issue May 7, 2020 · 6 comments
Closed

remoteUser in devcontainer.json doesn't work in corporate environment #2957

clssn opened this issue May 7, 2020 · 6 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug containers Issue in vscode-remote containers

Comments

@clssn
Copy link

clssn commented May 7, 2020

Issue Type: Bug

Reason: users are not listed in /etc/passwd because they are taken from a corporate domain controller via sssd.
Potential solution: use id -u username and id -g username to determine the user's uid/gid.

VS Code version: Code 1.44.2 (ff915844119ce9485abfe8aa9076ec76b5300ddd, 2020-04-16T17:50:03.709Z)
OS version: Linux x64 4.15.10-041510-generic
Fetching remote diagnostics for 'Dev Container: C++' failed.

@chrmarti chrmarti transferred this issue from microsoft/vscode May 8, 2020
@chrmarti chrmarti added containers Issue in vscode-remote containers feature-request Request for new features or functionality labels May 8, 2020
@SirFerdek
Copy link

SirFerdek commented Jul 6, 2021

Hi,
I thought I was doing something wrong when configuring my devcontainer, I missed a critical line in the documentation once again ;) or it's not supported with WLS2 and couldn't figure out why Developing inside a container on a remote docker host did not automatically update my UID and GID as described.

Turns out I hit the exact scenario as described by @clssn - my username does not exist in /etc/passwd on the remote host as it is recevied via sssd. I think the proper way to obtain numerical UID and GID in this environment would be to use something like

getent passwd USERNAME

It's a pity we cannot see the source code to fix this ourselves... ;) But well, the issue still exists and source code available probably since 04-2022 at https://github.com/devcontainers/cli

it cost me 6 hours of dev time. You guys probably have a lot on your plate either way, but is there any small chance this could be fixed in, like, next year maybe? :D

Or at least add a small disclaimer in the documentation, so guys like me stop wasting their time.

@jaron-l
Copy link

jaron-l commented Oct 13, 2021

As a note, there really isn't a great way to work around this. When trying to manually add the user to a container as suggested by the add non-root user doc, the Dockerfile needs the UID and GID to be passed in as build args. However, using the following devcontainer.json passes empty GID and UID varialbes so the build fails. The only solution I've come up with is to have developers manually edit the Dockerfile to use their UID and GID and not commit it.

"name": "Example",
	"build": {
		"dockerfile": "Dockerfile",
        "args": {
            "USERNAME": "${env:USER}",
            "USER_UID": "${env:UID}",
            "USER_GID": "${env:GID}"
        }
	},

@chrmarti chrmarti added bug Issue identified by VS Code Team member as probable bug and removed feature-request Request for new features or functionality labels Jul 3, 2023
@chrmarti
Copy link
Contributor

chrmarti commented Jul 6, 2023

Updating to use getent passwd <user> in Dev Containers extensions 0.300.0-pre-release.

@chrmarti chrmarti closed this as completed Jul 6, 2023
@Alwaysproblem
Copy link

it is worked for me with version v0.300.0, Thanks @chrmarti

@akkuman
Copy link

akkuman commented Aug 3, 2023

getent passwd <user>更新以在开发容器扩展 0.300.0-预发行版中使用。

getent passwd error ret code 2

but sudo getent passwd success

env:
ubuntu + samba AD

@chrmarti

@hoshikawa hoshikawa mentioned this issue Aug 5, 2023
3 tasks
@romankarlstetter
Copy link

I have a problem with this change. Our setup: windows domain controller with opensuse linux hosts. User name on linux host has the following format:
DOMAINNAME\username, i.e., it contains a backslash.

As a consequence, getent passwd DOMAINNAME\username fails with return code 2.

One of
getent passwd "DOMAINNAME\username" or
getent passwd DOMAINNAME\\username
would work.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug containers Issue in vscode-remote containers
Projects
None yet
Development

No branches or pull requests

7 participants