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

TeraTermで踏み台サーバ→別サーバへのssh接続を一発で。

訳あって一発でssh接続できない場合がよくある

ttlというマクロファイルを作る

  • hoge.ttlという形式でテキストファイルを新規作成。
  • ファイルを右クリック -> プロパティから変更でTera Term Macro Interpriterを選択
    • 多分C:\Program Files (x86)\teratermあたりにある。

ttlファイルの中身

接続先情報を記述して、それに沿ってコマンドを作るだけ!

;=====================================================================
; 踏み台接続情報
HOSTADDR = 'fumidai-server.com' ; <- 踏み台サーバのアドレス
USERNAME = 'my_user_name'   ; <- 踏み台サーバのusername
PASSWORD = 'password_hogehoge'  ; <- usernameに対するパスワード

; 目的サーバ接続情報
HOSTADDR2 = 'target-server.co.jp'   ; <- 目的サーバのアドレス
USERNAME2 = 'target_user_name'  ; <- 目的サーバのusername
PASSWORD2 = 'password_hugahuga' ; <- usernameに対するパスワード
;=====================================================================

; コマンドオプション組立て
COMMAND = HOSTADDR
strconcat COMMAND ':22 /ssh /2 /auth=password /user='
strconcat COMMAND USERNAME
strconcat COMMAND ' /passwd='
strconcat COMMAND PASSWORD

; 接続
connect COMMAND

; プロンプトを待つ
wait "$"

; 目的サーバへ接続
COMMAND = 'ssh '
strconcat COMMAND USERNAME2
strconcat COMMAND '@'
strconcat COMMAND HOSTADDR2
sendln COMMAND

wait 'password:'
sendln PASSWORD2

end

あとはこのttlファイルをダブルクリックすればつながる!!

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