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

Create a non-root default user with id 1000 #2133

Open
1 task done
matthewfeickert opened this issue Mar 11, 2023 · 1 comment
Open
1 task done

Create a non-root default user with id 1000 #2133

matthewfeickert opened this issue Mar 11, 2023 · 1 comment
Assignees
Labels
Docker Involving Docker images or builds feat/enhancement New feature or request good first issue Good for newcomers needs-triage Needs a maintainer to categorize and assign

Comments

@matthewfeickert
Copy link
Member

Summary

The default user for the pyhf images is root.

$ docker run --rm -ti --entrypoint /bin/bash pyhf/pyhf:v0.7.0
root@c2f8d937ca29:/# id
uid=0(root) gid=0(root) groups=0(root)

This isn't great, as it means that if a user bind mounts their local file system any files they write out will be created as root and they will need sudo permissions to remove them.

$ docker run --rm -ti -v $PWD:/example --entrypoint /bin/bash pyhf/pyhf:v0.7.0
root@0164cb9f3c8c:~# touch /example/here.txt
root@0164cb9f3c8c:~# ls -l /example/here.txt 
-rw-r--r-- 1 root root 0 Mar 11 22:40 /example/here.txt
root@0164cb9f3c8c:~# exit
exit
$ ls -l here.txt 
-rw-r--r-- 1 root root 0 Mar 11 16:40 here.txt

It is perferable to have a default user that is id 1000

$ docker run --rm -ti --user 1000:1000 -v $PWD:/example --entrypoint /bin/bash pyhf/pyhf:v0.7.0
I have no name!@e85dad7d317d:/$ touch /example/here-id1000.txt
I have no name!@e85dad7d317d:/$ ls -l /example/here-id1000.txt 
-rw-r--r-- 1 1000 1000 0 Mar 11 22:42 /example/here-id1000.txt
I have no name!@e85dad7d317d:/$ exit
exit
$ ls -l here-id1000.txt 
-rw-r--r-- 1 feickert feickert 0 Mar 11 16:42 here-id1000.txt

Additional Information

No response

Code of Conduct

  • I agree to follow the Code of Conduct
@matthewfeickert matthewfeickert added feat/enhancement New feature or request Docker Involving Docker images or builds needs-triage Needs a maintainer to categorize and assign labels Mar 11, 2023
@matthewfeickert matthewfeickert self-assigned this Mar 11, 2023
@matthewfeickert
Copy link
Member Author

They should also have control over the virtual environment.

@matthewfeickert matthewfeickert added the good first issue Good for newcomers label Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docker Involving Docker images or builds feat/enhancement New feature or request good first issue Good for newcomers needs-triage Needs a maintainer to categorize and assign
Projects
None yet
Development

No branches or pull requests

1 participant