swift-server / swift-server/swift-devcontainer-template
user id issues on Linux with vscode vs ubuntu user
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 70
- Forks
- 12
- Avg merge
- 8m
- Merged PRs (30d)
- 1
Description
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)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The report points to the devcontainer.json template and the swift:6.1 image; reproduce on Linux with host UID/GID 1000 and inspect how username and remoteUser are selected. Done means the resulting container user matches the host ID and can create files in /workspaces without permission errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift, vscode
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100