How do i know if my lxc container is nested?

moxfan

Active Member
Aug 28, 2013
99
5
28
Is there some sort of indicator inside the container that confirms that nesting has been enabled and is active?
 
Last edited:

Dunuin

Famous Member
Jun 30, 2020
3,088
652
113
Germany
Enabling nesting will give the LXC access to the hosts /dev and /proc. So I guess you could check if your LXC got rights to access these two folders.
 
Last edited:

moxfan

Active Member
Aug 28, 2013
99
5
28
Enableing nesting will give the LXC access to the hosts /dev and /proc. So I guess you could check if your LXC got rights to access these two folders.
Thanks. Does that mean what I see in the container's /dev and /proc folders are actually the host's /dev and /proc folders?
 

Dunuin

Famous Member
Jun 30, 2020
3,088
652
113
Germany
Jep, a LXC basically shares the same hardware and linux kernel with the host. Thats also why you see all the hosts CPU cores and RAM if you run top inside the LXC. Your LXC and host are basically the same machine. And your /dev folder isn't a typical filesystem, using /dev will directly link you to the hosts hardware. So if you for example write to /dev/sda you write to your physical disk and not to a folder that is stored on that disk.
So using LXCs is always more risky compared to a VM, because if the LXC gets hacked it is way easier to do bad stuff with your host. Especially if you use privileged LXCs where your LXCs root user is also the root user of your host. So if you are using a privileged LXC with nesting and that LXC gets hacked, the hacker is also your hosts root user and has access to all your hardware and can for example format all of your drives.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!