0

I'm running an Amazon Fire HD 7 first gen, with CyanogenMod 11 on it. Here are my system settings since they're required on Reddit:

I'm trying to set up SSH with a shared key on CyanogenMod. Normally, it's very easy to connect to my server, but I'm having difficulty setting this up.

I did

ssh-keygen -t rsa -b 4096

on my Kindle as root, because the user didn't have access to the folders (why is this, by the way? Why can't the user even see the data folder?). I put the key in the default folder with the default file name, which was /data/.ssh/id_rsa. Then I copied id_rsa.pub over to the authorized_keys file on my server, where all the other keys that work are. I restarted the SSH server, but it keeps telling me the public key failed. I ran SSh with the -vv option, and it tells me the same thing, that the keys are not matching with the error message Permission denied (publickey).

What do I need to do to get the server to recognize the key?

5
  • Are you sure it's even looking at the /data/.ssh directory for the key? That seems like kind of an odd place for it to go since it's not a directory user processes could access without root. Are you basing this setup on some sort of instructions or documentation? Maybe it would help if we could see the steps you're trying to follow in their full context. Nov 14, 2014 at 20:32
  • @eldarerathis unfortunately I haven't found a guide that involves setting up cyanogenmod as a client, only one that sets it up as a server. These are exactly the steps that I have followed, based on my experiences in setting up ssh and some googling for information. I have no idea why ssh-keygen would choose /data/.ssh/id_rsa as the default because, as you said, it is not accessible to the user. I only ever use ubuntu, so this flavor of linux is completely new to me, so I'm struggling through it.
    – jfa
    Nov 14, 2014 at 21:16
  • Why not just move the key to somewhere the ssh binary can read it? You'll probably need to check the owner and permissions on it too.
    – Dan Hulme
    Nov 14, 2014 at 22:25
  • @DanHulme Sorry, I think I'm not being very clear with this. I'll go back and edit the question. After I got root to ssh using the -i option, I moved the private ssh key to a location readable by the user and did chown u0_a67. The issue is that I'm not really sure where to put the key so that I don't have to use the -i option. I am also trying to create an alias so that instead of having to type ssh -i /folder/secondfolder/anotherfolder/file [email protected] I can type a short command that will be interpretted as that.
    – jfa
    Nov 14, 2014 at 22:39
  • @DanHulme still not sure why, as root, it checked /data/.ssh/id_rsa and, despite the file being there and apparently correct, it said rejected the key. also not sure how I'm supposed to do this without the -i option using the default user.
    – jfa
    Nov 14, 2014 at 22:40

1 Answer 1

1

I did more digging, and it looks like this has been a pretty typical problem throughout the versions of CyanogenMod. Not sure if it's a bug or I just lack understanding of the problem.

I was able to connect using ssh -i and specify the address of the key. When I had set the -v flag, it checked the key I was using and said it didn't match. So I'm thinking at best ssh ships so it's not set up correctly, and at worst something is broken.

I made an alias so that I don't have to type out -i, then the address, then the other options I want, then the user and hostname every time I want to connect to my home server.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .