Effective Computer Science - 頂は礎の上に -

新しい技術の多くは基礎的な技術の上に成り立っています。激動の技術変化に耐えうる体系知識の習得を目的に「基礎と実践の架け橋」となるサイトを目指します。

【Teraterm】秘密鍵を使ったssh接続を1クリックで行う

方法

ttlスクリプトをteraterm macro interpreter(ttermpro.exe)で実行する。

f:id:hatanaman2:20191212233905p:plain
ttermpro.exe

スクリプト

instance1_ssh2login.ttl

username, hostname, key_fileの値を修正するだけ。

username = 'ec2user'
hostname = '140.238.xxx.xxx'
key_file = 'C:\Users\xxx\Desktop\xxx.ppk'
portnum = '22'


msg = hostname
strconcat msg ':portnum /ssh /auth=publickey /user='
strconcat msg username
strconcat msg ' /keyfile=' 
strconcat msg key_file
strconcat msg inputstr

connect msg