Help us understand the problem. What is going on with this article?

sshの設定をconfigに書いたらssh接続がラクになる

More than 3 years have passed since last update.

ssh接続のショートカット

ssh -i .ssh/aws.pem -p 22 ec2user@11.111.111.1

ssh接続するときにこんな感じで書くのめんどくさくないですか?
解決策として.ssh/configに設定を書けばラクになります。

vim .ssh/config

configに以下を記入

Host pro_aws
  Hostname 11.111.111.1 //ipアドレス
  Port 22 //port番号
  User ec2-user //ユーザー名
  IdentityFile .ssh/aws.pem
ssh pro_aws

これでサーバーに入ることができる。

おまけ(ssh 接続をタイムアウトの設定)

SSH(SSHのクライアント)の設定を変更する

vim .ssh/config

configに以下を記入

ServerAliveInterval 60
ServerAliveCountMax 3

ServerAliveInterval 60 に設定すると 60秒毎にサーバーにメッセージを
送り、ServerAliveCountMax のデフォルト回数である 3回まで繰り返す。
つまり、サーバーが応答しなくなった後 180秒後に接続を切断する。

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away