[SOLVED] dmesg outside VM

Andrii

Member
Jul 6, 2016
50
0
6
36
I run the command 'dmesg' into the VM 101 and can see the logs for VM 108. Why this is possible?
 

fabian

Proxmox Staff Member
Staff member
Jan 7, 2016
4,523
706
133
that is not a VM, it is a container - and containers share a kernel (including the kernel's dmesg facility). you can disable access for non-root users (and thus also for unprivileged containers) by setting the sysctl kernel.dmesg_restrict to 1
 

Andrii

Member
Jul 6, 2016
50
0
6
36
And
Code:
sysctl -w kernel.dmesg_restrict=1
does not help for root into unprivileged container.
 

fabian

Proxmox Staff Member
Staff member
Jan 7, 2016
4,523
706
133
should work - please verify that you set the sysctl correctly (and that you are actually testing with an unpriv. container!)

Code:
$ echo 0 | sudo tee /proc/sys/kernel/dmesg_restrict
0
$ sudo pct enter 123
root@unprivtest:/# dmesg | head -3
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
root@unprivtest:/# exit

$ echo 1 | sudo tee /proc/sys/kernel/dmesg_restrict
1
$ sudo pct enter 123
root@unprivtest:/# dmesg | head -3
dmesg: read kernel buffer failed: Operation not permitted
root@unprivtest:/# exit
 

Andrii

Member
Jul 6, 2016
50
0
6
36
Found the solution
Need to add syslog errno 1 into /usr/share/lxc/config/common.seccomp
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE 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!