0

I am trying to install RVM in my Ubuntu machine with the following info:

  • DISTRIB_ID=Ubuntu
  • DISTRIB_RELEASE=14.04
  • DISTRIB_CODENAME=trusty
  • DISTRIB_DESCRIPTION="Ubuntu 14.04 LTS

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?

Community
  • 1
  • 1
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266
  • what are the ownership settings and permissions on the file in question? – sevenseacat Jul 21 '15 at 15:03
  • 2
    possible duplicate of [gpg: WARNING: unsafe ownership on configuration file, $gpg --fingerprint on Ubuntu9.10](http://stackoverflow.com/questions/2182938/gpg-warning-unsafe-ownership-on-configuration-file-gpg-fingerprint-on-ubun) – Maxim Pontyushenko Jul 21 '15 at 15:04
  • 1
    Assuming that you are running that as `fl4m3ph03n1x` user: `sudo chown fl4m3ph03n1x /home/fl4m3ph03n1x/.gnupg/gpg.conf && chmod 600 /home/fl4m3ph03n1x/.gnupg/gpg.conf` – Aleksei Matiushkin Jul 21 '15 at 15:09
  • @mudasobwa: I changed the permissions of the file using both chmod 600 and 700 and I still have the exact same problem. I have no way to be sure if this is a permission issue or not :S – Flame_Phoenix Jul 21 '15 at 15:15
  • @MaximPontyushenko: tested, but not fixed. I edited the post accordingly. – Flame_Phoenix Jul 21 '15 at 15:16
  • Edited the question to have more information. As one can see, the user "fl4m3ph03n1x" has -rwx permissions to the file :S – Flame_Phoenix Jul 21 '15 at 15:18
  • 1
    It should be exactly 600, not 700. 700 must be set for the folder `~/.gnupg`. – Aleksei Matiushkin Jul 21 '15 at 15:25
  • @mudasobwa: Ahhh ... Well, I got it working now with 700 also. The problem was that several files depended on permissions in a cascade. I will post my answer soon, thanks ! (kudos++ for you) – Flame_Phoenix Jul 21 '15 at 15:29

1 Answers1

0

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:

  1. /home/[username]/.gnupg/gpg.conf
  2. /home/[username]/.gnupg/pubring.gpg
  3. /home/[username]/.gnupg/trustdb.gpg

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!

Community
  • 1
  • 1
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266
  • `600` is `rw`, while `700` is `xrw`. It’s not “for folders,” it just permits execution of the underlying inode. And in case of folder execution means a permission to enter a folder. – Aleksei Matiushkin Jul 21 '15 at 15:58