LoginSignup
0
2

More than 5 years have passed since last update.

sshの接続の設定を行う方法

Posted at

sshを行うときにいちいち情報を書くのがめんどいので、configファイルに設定しておく

ファイルの場所

Terminal.
$ vi ~/.ssh/config
// ここにsshで使う接続情報を記載する

ファイルの編集

config.

Host hoge                   // Host名は、わかりやすいのにしておく
 HostName 192.168.0.1       // 自分のサーバのIPアドレス
 Port 22                    // sshのポート番号
 User test                  // サーバのユーザ名
 IdentityFile ~/.ssh/id_rsa // 秘密鍵。格納場所は、好きなところに。。。

Host hogehoge
 HostName 192.168.0.2
 Port 11122
 User testtest
 IdentityFile ~/.ssh/id_rsa

ssh実行

Terminal.
$ ssh hoge
// 上記のHost hoge の設定情報が実行される
0
2
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
0
2