Page MenuHomeFreeBSD

chroot: Improve error message for unprivileged use
ClosedPublic

Authored by emaste on Aug 1 2025, 7:51 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 13, 2:44 PM
Unknown Object (File)
Sun, Oct 12, 1:37 AM
Unknown Object (File)
Sat, Oct 11, 4:05 PM
Unknown Object (File)
Sat, Oct 11, 4:05 PM
Unknown Object (File)
Sat, Oct 11, 4:05 PM
Unknown Object (File)
Sat, Oct 11, 7:37 AM
Unknown Object (File)
Fri, Oct 10, 3:02 AM
Unknown Object (File)
Fri, Oct 3, 12:07 AM
Subscribers

Details

Summary

chroot(2) can be used by unprivileged users if the security.bsd.allow_unprivileged_chroot sysctl is set, but requires that the -n command line flag be specified so that chroot(8) will set the PROC_NO_NEW_PRIVS_CTL process control. Provide an explicit error for this case.

Before:

$ chroot / /bin/sh
chroot: /: Operation not permitted

After:

$ chroot / /bin/sh 
chroot: unprivileged use requires -n

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable