Vue normale

Reçu aujourd’hui — 14 mai 2025

su or sudo in chroot: beware of nosuid mount

14 mai 2025 à 09:37

For su or sudo to work, the rootfs has to be mounted suid -- which is obvious when you know how it work or think about it. sudo is nice enough to hint us at it, but sud isn't.

Either way, when chrooting you need to make sure the partition holding your new root is not mounter nosuid. Any user-mounted partition usually is (for fairly obvious security reasons I guess), so if you're plugging in a drive, make sure you mount it manually or remount it mount -o remount,suid.
Then, su and sudo should work fine in the chroot (at least if you mounted all the bits like /proc, /sys, /dev, /dev/pts and al.).

Beware of shady stuff though, obviously.


Permalink
❌