homectl: write recovery key file via linkable tmpfile

Create the file with open_tmpfile_linkable_at().
Write the recovery key and trailing newline to the temporary fd.
Set the final mode to 0600 before publishing it.
Link it into place with link_tmpfile_at(..., LINK_TMPFILE_SYNC).
This commit is contained in:
dongshengyuan
2026-08-25 06:57:32 +09:00
committed by Yu Watanabe
parent 3f72568682
commit 471e34d5cb
6 changed files with 200 additions and 12 deletions
+11
View File
@@ -692,6 +692,17 @@
<xi:include href="version-info.xml" xpointer="v247"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--recovery-key-file=<replaceable>PATH</replaceable></option></term>
<listitem><para>Attempts to write the generated recovery key to the specified file. The file is
created with access mode <literal>0600</literal> and must not exist yet. This option may only be used
together with <option>--recovery-key=yes</option>. If the file cannot be written, a warning is shown
and the account operation still succeeds. The recovery key is always shown on screen.</para>
<xi:include href="version-info.xml" xpointer="v262"/></listitem>
</varlistentry>
</variablelist>
</refsect1>