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
asked 5 years ago1240 views
2 Answers
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
answered 5 years ago
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
answered 5 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions