Wrote a silly script to showcase how to use unshare + chroot/pivot_root in order to manually enter a #linux #chroot / #container without needing #root privileges:
https://gist.github.com/mid-kid/9293f4f0617052b9c3aa45422fb89f90
I rarely see anyone mention how this can be done without needing to reach for #bubblewrap or systemd-nspawn, and I think it's important to see how you can leverage the primitives that drive container technology.
The script can be simplified, but not without sacrificing correctness. I hope the comments help.






