Sample Header Ad - 728x90

Why does setting `umask` to `0077` (and then downloading public key) makes a gpg public key unavailable for apt?

2 votes
1 answer
94 views
Why does setting umask to 0077 makes a gpg public key unavailable for apt when installing a package, e.g .
umask 0077
curl -fsSLo /usr/share/keyrings/brave-browser-beta-archive-keyring.gpg https://brave-browser-apt-beta.s3.brave.com/brave-browser-beta-archive-keyring.gpg 
  echo "deb [signed-by=/usr/share/keyrings/brave-browser-beta-archive-keyring.gpg] https://brave-browser-apt-beta.s3.brave.com/  stable main">/etc/apt/sources.list.d/brave-browser-beta.list
apt update
apt install brave-browser-beta
The above does not work, I get this output:
Err:4 https://brave-browser-apt-beta.s3.brave.com  stable InRelease    
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0B31DBA06A8A26F9
Reading package lists... Done
W: GPG error: https://brave-browser-apt-beta.s3.brave.com  stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0B31DBA06A8A26F9
E: The repository 'https://brave-browser-apt-beta.s3.brave.com  stable InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
This does work:
umask 0022
curl -fsSLo /usr/share/keyrings/brave-browser-beta-archive-keyring.gpg https://brave-browser-apt-beta.s3.brave.com/brave-browser-beta-archive-keyring.gpg 
  echo "deb [signed-by=/usr/share/keyrings/brave-browser-beta-archive-keyring.gpg] https://brave-browser-apt-beta.s3.brave.com/  stable main">/etc/apt/sources.list.d/brave-browser-beta.list
apt update
apt install brave-browser-beta
Why does setting umask to 0077 (and then downloading public key) makes a gpg public key unavailable for apt? The key was downloaded as root, and so was executed apt update, why then this issue?
Asked by John Smith (827 rep)
Jun 9, 2024, 01:06 PM
Last activity: Jun 9, 2024, 02:33 PM