]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
machine-bind-user: Make home mount directory configurable
authorDaanDeMeyer <daan.j.demeyer@gmail.com>
Fri, 22 Aug 2025 09:02:29 +0000 (11:02 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 22 Oct 2025 14:42:50 +0000 (16:42 +0200)
src/nspawn/nspawn.c
src/shared/machine-bind-user.c
src/shared/machine-bind-user.h

index 220ae7ec9fc4956c5ff92e1141fbb920d2324787..a47fcb22949c3e77f256ac20ccc46206ea55ebbc 100644 (file)
@@ -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;
index 947be1ba953d491044e7b5892d7b7d55517230d9..476536ea2813864c4275bcd2e84787853de7d13d 100644 (file)
@@ -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;
 
index 2751bc315b20367a91cd84e4e8eadf35cff36b28..c5537d34d2b5a6a88a2f72ae5da79ee6ecfa99ca 100644 (file)
@@ -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);