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年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ