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
已提问 5 年前1255 查看次数
2 回答
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
已回答 5 年前
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
已回答 5 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则