sudo preserves $HOME IIRC, which might be the problem here. But you don't quote the error message ...
Second issue: --recv-keys is a gpg command, whereas --keyserver is an option. gpg expects options before commands. So the first --recv-keys might be a problem in several cases. But that's JFTR.
It works from the root user account without any issues. So become root or try the -H switch of sudo or fix the sudoers file - I guess this will help. Please ask such things on your favourite Ubuntu user list/newsgroup/community.
sudo preserves $HOME IIRC, which might be the problem here. But you don't quote the error message ...
Second issue: --recv-keys is a gpg command, whereas --keyserver is an option. gpg expects options before commands. So the first --recv-keys might be a problem in several cases. But that's JFTR.
It works from the root user account without any issues. So become root or try the -H switch of sudo or fix the sudoers file - I guess this will help. Please ask such things on your favourite Ubuntu user list/newsgroup/ community.