this post was submitted on 16 Dec 2025
163 points (97.7% liked)
Linux
60376 readers
634 users here now
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 6 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
docker run --rm -it --privileged --pid=host debian:12 nsenter -a -t1 "$(which bash)"If your user is in the
dockergroup, and you are not running rootless Docker, this command opens a bash shell as root.How it works:
docker run --rm -itcreates a temporary container and attaches it to the running terminal--privilegeddisables some of the container's protections--pid=hostattaches the container to the host's PID namespace, allowing it to access all running processesdebian:12uses the Debian 12 imagensenter -a -t1enters all the namespaces of the process with PID 1, which is the host's init since we use--pid=host"$(which bash)"finds the path of the host's bash and runs it inside the namespaces (plainbashmay not work on NixOS hosts)So you're running bash "as if you're on the host systen". What's the benefit?
I just wanted to show how Docker can be abused for privilege escalation, when it's not properly configured