user id issues on Linux with vscode vs ubuntu user
Opened this issue · 2 comments
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)
Yeah we had to remove the explicit vscode user id with 6.1
I am open to using the ubuntu user but am not certain about security implications. I had hoped to follow the other container templates but the swift images appear to make that hard.
I already have a PR fixing this.