firstboot: don't create /etc/passwd with mode 000
authorLennart Poettering <lennart@poettering.net>
Thu, 23 Jul 2020 12:24:38 +0000 (14:24 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 23 Jul 2020 15:09:11 +0000 (17:09 +0200)
It needs to be world readable (unlike /etc/shadow) when created anew.

This fixes systems that boot with "systemd-nspawn --volatile=yes", i.e.
come up with an entirely empty /etc/ and thus no existing /etc/passwd
file when firstboot runs.

src/firstboot/firstboot.c

index 82cd404..807a4f5 100644 (file)
@@ -685,7 +685,7 @@ static int write_root_passwd(const char *passwd_path, const char *password, cons
                 if (errno != ENOENT)
                         return -errno;
 
-                r = fchmod(fileno(passwd), 0000);
+                r = fchmod(fileno(passwd), 0644);
                 if (r < 0)
                         return -errno;