chroot-user: better error message, if unshare is not allowed
This commit is contained in:
parent
edb59ee7bd
commit
438fb59e6f
@ -128,7 +128,7 @@ int main(int argc, char *argv[]) {
|
|||||||
// If we are root, no need to create new user namespace.
|
// If we are root, no need to create new user namespace.
|
||||||
if (uid == 0) {
|
if (uid == 0) {
|
||||||
if (unshare(CLONE_NEWNS) < 0)
|
if (unshare(CLONE_NEWNS) < 0)
|
||||||
errorf(EX_OSERR, "unshare");
|
errorf(EX_OSERR, "unshare() failed: You may have an old kernel or have CLONE_NEWUSER disabled by your distribution security settings.");
|
||||||
// Mark all mounted filesystems as slave so changes
|
// Mark all mounted filesystems as slave so changes
|
||||||
// don't propagate to the parent mount namespace.
|
// don't propagate to the parent mount namespace.
|
||||||
if (mount(NULL, "/", NULL, MS_REC | MS_SLAVE, NULL) < 0)
|
if (mount(NULL, "/", NULL, MS_REC | MS_SLAVE, NULL) < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user