認証は暗号化したパスワードファイルを使用。
初回ログイン時のみパスワード入力し、次回以降は初回時に生成されたdatファイルを自動的に参照
下記内容をテキストに記載し、拡張子を.ttlにする
qiita.rb
username = 'ユーザー名'
passwdfile = 'passwd.dat'
portnum = '22'
getpassword passwdfile username userpasswd
strdim HOSTNM 3 ←合計数を記入
HOSTNM[0] = 'ホスト名'
HOSTNM[1] = 'ホスト名'
HOSTNM[2] = 'ホスト名'
strdim HOSTIP 3 ※上記のホストに対応したIPをそれぞれ記入する
HOSTIP[0] = 'ipアドレス'
HOSTIP[1] = 'ipアドレス'
HOSTIP[2] = 'ipアドレス'
;============================================
listbox '接続するホストを選択して下さい' '接続ホスト選択' HOSTNM
if result >= 0 then
HOSTADDR = HOSTIP[result]
else
end
endif
COMMAND = HOSTADDR
strconcat COMMAND ':portnum /ssh /auth=password /user='
strconcat COMMAND username
strconcat COMMAND ' /passwd='
strconcat COMMAND userpasswd
strconcat COMMAND inputstr
connect COMMAND
end
単体サーバ向け
qiita.rb
username = 'ユーザー名'
hostname = 'ip'
passwdfile = 'passwd.dat'
portnum = '22'
getpassword passwdfile username userpasswd
msg = hostname
strconcat msg ':portnum /ssh /auth=password /user='
strconcat msg username
strconcat msg ' /passwd='
strconcat msg userpasswd
strconcat msg inputstr
connect msg
もしくは
qiita.rb
username = 'ユーザー名'
hostname = 'ip'
portnum = '22'
msg = hostname
strconcat msg ':'
strconcat msg portnum
strconcat msg ' /ssh /2 /auth=publickey /user='
strconcat msg username
strconcat msg ' /auth=pageant'
strconcat msg ' /ssh-A'
strconcat msg ' /ssh-agentconfirm=off'
connect msg
踏み台経由
qiita.rb
username = 'ユーザー名'
hostname = '踏み台ip'
passwdfile = 'passwd.dat'
portnum = '22'
getpassword passwdfile username userpasswd
HOSTIP = '踏み台の先ip'
msg = hostname
strconcat msg ':portnum /ssh /auth=password /user='
strconcat msg username
strconcat msg ' /passwd='
strconcat msg userpasswd
strconcat msg inputstr
connect msg
wait '$' '#'
COMMAND = 'ssh '
strconcat COMMAND HOSTIP
sendln COMMAND
end
もしくは
qiita.rb
username = 'ユーザー名'
hostname = '踏み台ip'
portnum = '22'
HOSTIP = '踏み台の先ip'
msg = hostname
strconcat msg ':'
strconcat msg portnum
strconcat msg ' /ssh /2 /auth=publickey /user='
strconcat msg username
strconcat msg ' /auth=pageant'
strconcat msg ' /ssh-A'
strconcat msg ' /ssh-agentconfirm=off'
connect msg
wait '$' '#'
COMMAND = 'ssh '
strconcat COMMAND HOSTIP
sendln COMMAND
end