on my server i try to get the keys and execute the command
gpg --keyserver keyserver.ubuntu.com --recv-keys 1E9377A2BA9EF27F
but I get that the server is not available
gpg: keyserver receive failed: No keyserver available
but when i do the same on my local machine everything works fine.the key is imported. help me pls dns is the same on the server and on my local computer. difference in versions of gpg and dirmngr on local 2.2.12 on server 2.2.4 Ubuntu 18.04
it worked for me
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 34893610CEAA9512
you can use script
#!/bin/bash
declare -a keyservers=(
"hkp://keyserver.ubuntu.com:80"
"keyserver.ubuntu.com"
"ha.pool.sks-keyservers.net"
"hkp://ha.pool.sks-keyservers.net:80"
"p80.pool.sks-keyservers.net"
"hkp://p80.pool.sks-keyservers.net:80"
"pgp.mit.edu"
"hkp://pgp.mit.edu:80"
)
keys=$(apt update 2>&1 | grep -o '[0-9A-Z]\{16\}$')
for key in $keys; do
for server in "${keyservers[@]}"; do
echo "Fetching GPG key ${key} from ${server}"
apt-key adv --keyserver $server --keyserver-options timeout=10 --recv-keys ${key}
if [ $? -eq 0 ]; then
echo "Key '${key}' successful added from server '${server}'"
break
else
echo "Failed add key '${key}' from server '${server}'. Try another server"
continue
fi
done
done