1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Amazon EC2にMacでSSH接続する

1
Posted at

会社の Amazon EC2に接続しないといけないことがあったので、備忘として残します。
初心者は権限まわりを先に学ぶべきだと思った。。

必要な情報

・接続先EC2のグローバルIPアドレス or ホスト名
・ユーザ名
・秘密鍵(デフォルトは**.pemというファイル形式になります)

Linux操作

秘密鍵をホームディレクトリに配置します。

その後秘密鍵をsshに移動し、chmod(chenge mode?)で秘密鍵を読み書きできる権限に変更します。


$ mv 秘密鍵名.pem ~/.ssh/
$ chmod 600 ~/.ssh/秘密鍵名.pem

chmodについては下記が分かりやすかったです。

後は以下のコマンドでIPアドレスのEC2にssh接続ができます。


$ ssh -i ~/.ssh/秘密鍵名.pem [ユーザ名]@[IPアドレス or DNS名]

EC2接続はタイムアウトするので、常に自分が今どこに接続しているかlsコマンドで確認する癖をつける!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?