diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-02-19 12:03:39 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-02-19 12:03:39 +0100 |
commit | 6278cf604834ab3535934209a704f222e472bf17 (patch) | |
tree | cad4128494267e978bff5031bbf5da1a86359774 /src | |
parent | d15d65a01fe02fc66c3a9664fa9eab983f0f5024 (diff) |
nspawn: chown basic device nodes to userns root
Diffstat (limited to 'src')
-rw-r--r-- | src/nspawn/nspawn.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 9967423dbc..0d8d199de2 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -1444,6 +1444,10 @@ static int copy_devnodes(const char *dest) { if (mknod(to, st.st_mode, st.st_rdev) < 0) return log_error_errno(errno, "mknod(%s) failed: %m", to); + + if (arg_userns && arg_uid_shift != UID_INVALID) + if (lchown(to, arg_uid_shift, arg_uid_shift) < 0) + return log_error_errno(errno, "chown() of device node %s failed: %m", to); } } @@ -1460,6 +1464,10 @@ static int setup_ptmx(const char *dest) { if (symlink("pts/ptmx", p) < 0) return log_error_errno(errno, "Failed to create /dev/ptmx symlink: %m"); + if (arg_userns && arg_uid_shift != UID_INVALID) + if (lchown(p, arg_uid_shift, arg_uid_shift) < 0) + return log_error_errno(errno, "lchown() of symlink %s failed: %m", p); + return 0; } |