Signature problem with apt-get update

I tried this and failed, probably because I don’t know a lick about gpg.

When I ran gpg --recv-keys 379CE192D401AB61 if seemed to work:

gpg: requesting key D401AB61 from hkp server keys.gnupg.net
gpg: /home/rich/.gnupg/trustdb.gpg: trustdb created
gpg: key D401AB61: public key "Bintray (by JFrog) <bintray@bintray.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)

but when I run the second line as me I get:

ERROR: This command can only be used by root.

When I try to sudo the command:

[sudo] password for rich: ERROR: This command can only be used by root.

gpg: WARNING: unsafe ownership on configuration file `/home/rich/.gnupg/gpg.conf'
gpg: [stdout]: write error: Broken pipe
gpg: iobuf_flush failed on close: file write error

If I step back, remove my .gnupg folder and try to run the first command with sudo I get:

gpg: directory `/home/rich/.gnupg' created
gpg: new configuration file `/home/rich/.gnupg/gpg.conf' created
gpg: WARNING: options in `/home/rich/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/home/rich/.gnupg/secring.gpg' created
gpg: keyring `/home/rich/.gnupg/pubring.gpg' created
gpg: no keyserver known (use option --keyserver)
gpg: keyserver receive failed: bad URI

I’m on an Ubuntu server with the root account locked and I’m not inclined to unlock it to solve this problem.

Update:

I tried to chown the contents of .gnupg to root and run the --export with sudo and is still says:

ERROR: This command can only be used by root.

So I think the solution above only works for those who can log in as root. Ubuntu users will have to wait.

Thanks!