VOOZH about

URL: https://qiita.com/ucan-lab/items/21d62f1beaa8007c4ca9

⇱ Mac SSH 設定 #Mac - Qiita


👁 Image
35

Go to list of users who liked

26

Share on X(Twitter)

Share on Facebook

Add to Hatena Bookmark

More than 5 years have passed since last update.

@ucan-lab

Mac SSH 設定

35
Last updated at Posted at 2020-03-29

ssh コマンドとは

$ ssh [オプション] ホスト名 [コマンド]

SSH(Secure Shell)は、暗号や認証の技術を利用して、安全にリモートコンピュータと通信するためのプロトコルです。

SSHの設定

ディレクトリ、ファイルの存在確認

$ ls -l ~/.ssh/config

~/.ssh ディレクトリ、 ~/.ssh/config ファイルがない場合は作成しましょう。

$ mkdir ~/.ssh
$ touch ~/.ssh/config

パーミッション設定

$ sudo chown -R $(whoami):staff ~/.ssh
$ sudo chmod 700 ~/.ssh
$ sudo chmod -R 600 ~/.ssh/*

拡張属性の除去

ダウンロードした鍵ファイルに拡張属性(EA: Extended Attributes)が付いてる場合があります。(ls -l パーミッションの右側に @ マークが付く)

$ xattr -cr ~/.ssh

全ホストに共通設定

私は次の設定を入れてます。
お好みで追加してください。

$ vi ~/.ssh/config
Host *
 StrictHostKeyChecking no
 UserKnownHostsFile=/dev/null
 ServerAliveInterval 15
 ServerAliveCountMax 30
 AddKeysToAgent yes
 UseKeychain yes
 IdentitiesOnly yes
  • StrictHostKeyChecking no ホストキーチェック回避
  • UserKnownHostsFile=/dev/null ホストキーチェック回避
  • ServerAliveInterval 15 タイムアウト対策
  • ServerAliveCountMax 30 タイムアウト対策
  • AddKeysToAgent yes 毎回パスフレーズを聞かれてくることに対する対策
  • UseKeychain yes 毎回パスフレーズを聞かれてくることに対する対策
  • LogLevel QUIET 警告メッセージを非表示にする
    • Warning: Permanently added 'github.com,192.30.255.113' (RSA) to the list of known hosts. このメッセージ。

関連記事

35

Go to list of users who liked

26
0

Go to list of comments

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
35

Go to list of users who liked

26