I am trying to install RVM in my Ubuntu machine with the following info:
I am doing this by following the official RVM guide, presented here:
However I fail in the very first command, I cannot import mpapi's public key (even when using sudo):
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
I get the following error:
fl4m3ph03n1x: ~ $ sudo gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
gpg: WARNING: unsafe ownership on configuration file `/home/fl4m3ph03n1x/.gnupg/gpg.conf'
gpg: external program calls are disabled due to unsafe options file permissions
gpg: keyserver communications error: general error
gpg: keyserver receive failed: general error
At first I thought that the problem was a permission issue (by checking the warning), but after reading and trying out the solution in the discussion below nothing changed.
Here are the permissions on the file:
fl4m3ph03n1x: ~ $ ls -ld /home/fl4m3ph03n1x/.gnupg/gpg.conf
-rwx------ 1 fl4m3ph03n1x fl4m3ph03n1x 9398 Jul 21 14:43 /home/fl4m3ph03n1x/.gnupg/gpg.conf
fl4m3ph03n1x: ~ $ ls -l /home/fl4m3ph03n1x/.gnupg/gpg.conf
-rwx------ 1 fl4m3ph03n1x fl4m3ph03n1x 9398 Jul 21 14:43 /home/fl4m3ph03n1x/.gnupg/gpg.conf
What am I doing wrong ? How can I fix my problem?
It turns out that the problem was indeed fixed by file permissions. There are a few things I want to point out however.
The solution for this problem relies in changing the permission of several files in cascade.
For a more complete answer on permissions, I recommend this discussion, suggested by Maxim Pontyushenko:
Now for the solution itself. You must changed the ownership and the read/write permissions of the following files, in the following order:
You must change the permissions on these 3 files in this specific order.
Additionally, do not run the gpg command using sudo.
If you do it, you will be stuck on a error regarding safe file permissions to which i was not able to find any solution.
Instead, run the gpg
command using your username.
I hope this helps the next person having problems. Kudos++ to all who commented!