Skip to content

Commit d5468a1

Browse files
committed
Use relative path for gpg ephemeral homedir for security
This may be paranoid, but also avoids unwanted surprises of multi-user systems. Signed-off-by: Elan Ruusamäe <[email protected]>
1 parent 7923cd6 commit d5468a1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,41 +68,41 @@ You can skip this if your master key is not password protected.
6868
To remove the password from the subkey, create an ephemeral gpg home directory:
6969

7070
```bash
71-
mkdir /tmp/gpg
71+
install -d -m 700 gpg-tmp
7272
```
7373

7474
Ensure that it works with gpg:
7575

7676
```bash
77-
gpg --homedir /tmp/gpg --list-keys
77+
gpg --homedir gpg-tmp --list-keys
7878
```
7979

8080
You can ignore the warning about unsafe directory permissions.
8181

8282
Import your subkey:
8383

8484
```bash
85-
gpg --homedir /tmp/gpg --import private.key
85+
gpg --homedir gpg-tmp --import private.key
8686
```
8787

8888
Enter edit mode:
8989

9090
```bash
91-
gpg --homedir /tmp/gpg --edit-key <SubKey ID>
91+
gpg --homedir gpg-tmp --edit-key <SubKey ID>
9292
```
9393

9494
Type `passwd`, entering your current password and then set the password to "" to remove it.
9595

9696
Type `save` to exit edit mode and re-export your subkey:
9797

9898
```bash
99-
gpg --homedir /tmp/gpg --output private.key --armor --export-secret-subkeys "<SubKey ID>!"
99+
gpg --homedir gpg-tmp --output private.key --armor --export-secret-subkeys "<SubKey ID>!"
100100
```
101101

102102
Finally, remove the ephemeral directory:
103103

104104
```bash
105-
rm --rf /tmp/gpg
105+
rm --rf gpg-tmp
106106
```
107107

108108
You will now need to export your master public key with the new subkey public key to the file `public.key`:

0 commit comments

Comments
 (0)