Skip to content

Instantly share code, notes, and snippets.

@KomanRudden
Created January 18, 2018 16:31
Show Gist options
  • Save KomanRudden/5f4559052c918e9490ff16703a9832d2 to your computer and use it in GitHub Desktop.
Save KomanRudden/5f4559052c918e9490ff16703a9832d2 to your computer and use it in GitHub Desktop.
sudo apt-key list | \
grep "expired: " | \
sed -ne 's|pub .*/\([^ ]*\) .*|\1|gp' | \
xargs -n1 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys
Command explanation:
sudo apt-key list - lists all keys installed in the system;
grep "expired: " - leave only lines with expired keys;
sed -ne 's|pub .*/\([^ ]*\) .*|\1|gp' - extracts keys;
xargs -n1 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys - updates keys from Ubuntu key server by found expired ones.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment