Skip to content

user id issues on Linux with vscode vs ubuntu user #32

@mamoss-oss

Description

@mamoss-oss

Hi,
not sure if it is fixable in this repository or should be reported somewhere else. Just wanted to document the issue if others encounter it and reduce their time spent troubleshooting.

Using the devcontainer template with image swift:6.1 on Linux with a host user/group ID of 1000 will enter the devcontainer as user vscode with user/group ID of 1001, resulting in permission issues for any file changes.

vscode ➜ /workspaces/new $ id
uid=1001(vscode) gid=1001(vscode) groups=1001(vscode)
vscode ➜ /workspaces/new $ touch test
touch: cannot touch 'test': Permission denied

There is an existing user ubuntu in the container with the ID 1000.

vscode ➜ /workspaces/new $ getent passwd ubuntu
ubuntu:x:1000:1000:Ubuntu:/home/ubuntu:/bin/bash

Changing the devcontainer.json template to user ubuntu resolves the permission issues.

...
"username": "ubuntu",
...
"remoteUser": "ubuntu"
ubuntu ➜ /workspaces/new $ id
uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev)

Comparing it with other devcontainer templates the user id for vscode is 1000 and no changes need to be made in the template.
E.g. Go

vscode ➜ /workspaces/container $ id
uid=1000(vscode) gid=1000(vscode) groups=1000(vscode),998(nvm),999(golang)

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