From: DaanDeMeyer Date: Fri, 22 Aug 2025 09:02:29 +0000 (+0200) Subject: machine-bind-user: Make home mount directory configurable X-Git-Tag: v259-rc1~262^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af0ae29714310f6739d079b3938fef48b33c8768;p=thirdparty%2Fsystemd.git machine-bind-user: Make home mount directory configurable --- diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 220ae7ec9fc..a47fcb22949 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -4019,6 +4019,7 @@ static int outer_child( arg_bind_user, arg_bind_user_shell, arg_bind_user_shell_copy, + "/run/host/home", &bind_user_context); if (r < 0) return r; diff --git a/src/shared/machine-bind-user.c b/src/shared/machine-bind-user.c index 947be1ba953..476536ea281 100644 --- a/src/shared/machine-bind-user.c +++ b/src/shared/machine-bind-user.c @@ -93,6 +93,7 @@ static int convert_user( uid_t allocate_uid, const char *shell, bool shell_copy, + const char *home_mount_directory, UserRecord **ret_converted_user, GroupRecord **ret_converted_group) { @@ -123,7 +124,7 @@ static int convert_user( return log_error_errno(SYNTHETIC_ERRNO(EBUSY), "Sorry, the group '%s' already exists in the machine.", g->group_name); - h = path_join("/run/host/home/", u->user_name); + h = path_join(home_mount_directory, u->user_name); if (!h) return log_oom(); @@ -210,6 +211,7 @@ int machine_bind_user_prepare( char **bind_user, const char *bind_user_shell, bool bind_user_shell_copy, + const char *bind_user_home_mount_directory, MachineBindUserContext **ret) { _cleanup_(machine_bind_user_context_freep) MachineBindUserContext *c = NULL; @@ -279,7 +281,14 @@ int machine_bind_user_prepare( if (r < 0) return r; - r = convert_user(directory, u, g, current_uid, bind_user_shell, bind_user_shell_copy, &cu, &cg); + r = convert_user( + directory, + u, g, + current_uid, + bind_user_shell, + bind_user_shell_copy, + bind_user_home_mount_directory, + &cu, &cg); if (r < 0) return r; diff --git a/src/shared/machine-bind-user.h b/src/shared/machine-bind-user.h index 2751bc315b2..c5537d34d2b 100644 --- a/src/shared/machine-bind-user.h +++ b/src/shared/machine-bind-user.h @@ -27,4 +27,5 @@ int machine_bind_user_prepare( char **bind_user, const char *bind_user_shell, bool bind_user_shell_copy, + const char *bind_user_home_mount_directory, MachineBindUserContext **ret);