Can't ssh from mac terminal

0

I am trying to ssh via the mac terminal to my lightsail server. I downloaded a .pem from my account page as instructed with the following result:

Macintosh-2:Downloads stephendrozdik$ chmod 400 montrealkey.pem
Macintosh-2:Downloads stephendrozdik$ ssh -i montrealkey.pem ubuntu@35.182.130.76
ubuntu@35.182.130.76: Permission denied (publickey).
Macintosh-2:Downloads stephendrozdik$ ssh -v montrealkey.pem ubuntu@35.182.130.76
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to montrealkey.pem port 22.
ssh: Could not resolve hostname montrealkey.pem: nodename nor servname provided, or not known
Macintosh-2:Downloads stephendrozdik$

I also tried chmod 600, the default key, a generate key. Ideas?

Blender
gefragt vor 5 Jahren1255 Aufrufe
2 Antworten
0

On the 2nd command, you forgot the -i parameter before the pem file.

Try qualifying the path to the .pem file ($HOME/.ssh/montrealkey.pem, or something like that).

profile picture
David G
beantwortet vor 5 Jahren
0

Thanks for your reply! You are correct. I had tried -i in a previous attempt then switched to -v for a verbose explanation...showing how unskilled I am!

I did finally find a solution, although I do not know specifically what worked.

Just in case someone has similar issue I:

  1. re-downloaded .pem file
  2. moved it to ~/.ssh folder in my home folder (MacOS)
  3. chmod 400 .pem file
  4. removed server entry/line from 'known_hosts' file in ~/.ssh
  5. ssh'd using -i and providing full path to pem file
Blender
beantwortet vor 5 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen