0

I'm trying to follow this answer to set up SSH using a public/private key pair, and note just the remote machine password. I'm guessing the issue is that key pair is for a "different user", but I'm not too familiar with SSH. Additionally, I'm having difficulty making a keypair "for the correct user" (assuming this is my issue).

I log into the machine with ssh <official_email>@machine, where is some string (associated with the email <name1>@company.com). I have an existing keypair id_rsa, and id_rsa.pub where id_rsa.pub ends with the string <personal_email>@gmail.com. For whatever reason, following the instructions in the linked question don't work (the key file gets copied, which I verified, but I get prompted for the remote machine password each time anyway). It's my thought the issue is that the keypair I have ends with <personal_email>@gmail.com, and I need one that ends with <official_email> (probably @something, but I'm not entirely sure).

I've tried running ssh-keygen and saving it as a new file, but this ends with a file filename.pub that ends with <local_user>@<local_machine>, which isn't what I want at all.

So, my questions are:

  1. Am I on the right track with figuring this out? If so, how can I generate a key-pair that has <official_email>@machine?

  2. If not, what steps should I take for figuring this out?

1 Answers1

0

The end is a comment and won't matter.

The public key should be one line and appended to the authorized_keys file on server you are connecting to, in the ~/.ssh directory of the user ID you're trying to ssh in as.

The .ssh dir itself may need to have have its permissions changed, it should be mode 700

chmod 700 ~/.ssh

The authorized_keys file may need need changing, it should be mode 600

chmod 600 ~/.ssh/authorized_keys

Generating a new key creates 2 files, a private key (id_rsa if chose rsa default, mode 600) and public key (id_rsa.pub, mode 644) and this public key must be in the destination server authorized_keys file as a single line.

Paul
  • 61,193