• ssh接続
1
2
3
4
5
;単純接続
connect '192.168.1.38 /ssh /2 /auth=password /user=root /passwd=password /F=yellow.ini'

wait "]$"
sendln "df -h"
  • ssh接続マクロが参照する定義ファイルをy:\teraIni\gvis.iniに用意
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
gvis_iPTH = 'y:\\teraIni\\'
gvis_wS1  = ']$'
gvis_wS2  = ']#'
gvis_wS3  = 'パスワード:'
gvis_wS4  = 'nari$'
gvis_wS5  = 'Password:'
gvis_wS6  = 'C:\Users\nari>'
gvis_ws7  = 'nari@MacX-nari'
gvis_nari = 'password1'
gvis_nari2= 'password2'
gvis_MAIN = 'password3'
gvis_winP = 'winPassword'
gvis_macP = 'macPassword'
gvis_WhP  = 'drivePassword'
gvis_KY1  = 'Y:\\terIni\\key\\privateKEY'

;---- 
;---- zip -r -P xx dirname.zip ./dirname  
;---- unzip  -P xx dirname.zip
;---- 
;---- 記号を混ぜるとNG
gvis_psw1 = 'longlongPassword1'
gvis_psw2 = 'longlongPassword2'
gvis_pswP = 'longlongPassword3'

gvis_TOUT = '5'
gvis_COUT = 10

gvis_Yps1 = 'routerPassword1'
gvis_Yps2 = 'routerPassword2'

gvis_YwS1 = '>'
gvis_YwS2 = '#'
gvis_YwS3 = 'Password:'
gvis_YCot = 3
  • 定義ファイルを利用してローカルlinuxへssh接続
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
include 'y:\teraIni\gvis.ini'

; --- 接続 --------------
 conSTR = '172.16.17.218 /ssh /2 /auth=password /user=nari /passwd='
 strconcat conSTR gvis_nari
 strconcat conSTR ' /F='
 strconcat conSTR gvis_iPTH
 strconcat conSTR 'yellow.ini '
 strconcat conSTR '/timeout='
 strconcat conSTR gvis_TOUT

; ---debug --------------
; messagebox conSTR 'info'

 connect conSTR
 if result <> 2 goto end

wait gvis_wS1
sendln "df -h"

wait gvis_wS1
sendln "w"

wait gvis_wS1
sendln "onlchk"

:end
  • 定義ファイルを利用してGoogle Cloudのlinuxへssh接続
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
include 'y:\teraIni\gvis.ini'

; --- 接続 --------------
 conSTR = 'gcp-gvis-dklinux.intra.gavann-it.com  /ssh /auth=publickey  /user=nari /passwd='
 strconcat conSTR gvis_MAIN
 strconcat conSTR ' /keyfile='
 strconcat conSTR gvis_KY1
 strconcat conSTR ' /F='
 strconcat conSTR gvis_iPTH
 strconcat conSTR 'wine.ini '
 strconcat conSTR '/timeout='
 strconcat conSTR gvis_TOUT

; ---debug --------------
; messagebox conSTR 'info'

 connect conSTR
 if result <> 2 goto end

wait gvis_wS1
sendln "df -h"

wait gvis_wS1
sendln "w"

:end
  • teratermではフォントや色などの表示指定を保存して作成しておく(tertermウィンドウの「設定」->「設定の保存」)。以下、wine.iniで赤っぽい配色の定義サンプル。
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
[Tera Term]
Version=4.98
Language=Japanese
Port=tcpip
TerminalSize=90,35
TermIsWin=on
AutoWinResize=off
CRReceive=CR
CRSend=CR
LocalEcho=off
Answerback=
KanjiReceive=UTF-8
KatakanaReceive=8
KanjiSend=UTF-8
KatakanaSend=8
KanjiIn=B
KanjiOut=B
ConnectingTimeout=5
DisablePasteMouseRButton=off
ConfirmPasteMouseRButton=off
SelectOnlyByLButton=on
DisableAcceleratorSendBreak=off
EnableContinuedLineCopy=on
MouseCursor=ibeam
AlphaBlend=255
CygwinDirectory=c:\cygwin
ViewlogEditor=notepad.exe
Locale=japanese
CodePage=932
ANSIColor=0,0,0,0, 1,255,0,0, 2,0,255,0, 3,255,255,0, 4,128,128,255, 5,255,0,255, 6,0,255,255, 7,255,255,255, 8,0,0,0, 9,255,0,0, 10,0,255,0, 11,255,255,0, 12,128,128,255, 13,255,0,255, 14,0,255,255, 15,255,255,255
AutoWinSwitch=off
TerminalID=VT100
RussHost=Windows
RussClient=Windows
Title=Tera Term
CursorShape=block
HideTitle=off
PopupMenu=off
FullColor=on
EnableScrollBuff=on
ScrollBuffSize=10000
VTColor=255,29,202,72,27,21
VTBoldColor=0,0,255,72,27,21
VTBlinkColor=255,0,0,72,27,21
EnableClickableUrl=on
URLColor=0,255,0,72,27,21
TEKColor=0,0,0,255,255,255
TEKColorEmulation=off
VTFont=MS 明朝,0,-16,128
EnableBold=on
RussFont=Windows
TEKFont=Terminal,0,-8,128
BSKey=BS
DeleteKey=on
MetaKey=off
DisableAppKeypad=off
DisableAppCursor=off
RussKeyb=Windows
ComPort=1
BaudRate=9600
Parity=none
DataBit=8
StopBit=1
FlowCtrl=none
DelayPerChar=0
DelayPerLine=0
Telnet=off
TermType=vt100
TCPPort=22
AutoWinClose=on
Historylist=on
TransBin=off
LogAppend=on
LogTypePlainText=on
LogTimestamp=off
LogDefaultName=teraterm.log
LogDefaultPath=
LogAutoStart=off
XmodemOpt=checksum
XmodemBin=on
XmodemRcvCommand=
FileDir=C:\Program Files (x86)\teraterm
FileSendFilter=
Accept8BitCtrl=on
AllowWrongSequence=off
AutoFileRename=on
AutoTextCopy=on
BackWrap=off
Beep=on
BeepOnConnect=off
BPAuto=off
BPEscCtl=off
BPLog=off
ClearComBuffOnOpen=on
ConfirmDisconnect=on
CtrlInKanji=on
Debug=off
DelimList=$20!"#$24%&'()*+,:;<=>?@[\]^`{|}~
DelimDBCS=on
EnablePopupMenu=on
EnableShowMenu=on
EnableStatusLine=on
IME=on
IMEInline=on
KmtLog=off
LanguageSelection=on
MaxBuffSize=500000
MaxComPort=256
NonblinkingCursor=off
PassThruDelay=3
PassThruPort=
PrnFont=
PrnMargin=50,50,50,50
QVLog=off
QVWinSize=8
RussPrint=Windows
ScrollThreshold=12
SelectOnActivate=on
Send8BitCtrl=off
StartupMacro=
TEKGINMouseCode=32
TelAutoDetect=on
TelBin=off
TelEcho=off
TelLog=off
TelPort=23
TelKeepAliveInterval=300
MaxBroadcatHistory=99
TCPLocalEcho=off
TCPCRSend=
UseTextColor=off
TitleFormat=61
VTCompatTab=off
VTFontSpace=0,0,0,0
VTPPI=0,0
TEKPPI=0,0
WindowMenu=on
XmodemLog=off
ZmodemAuto=off
ZmodemDataLen=1024
ZmodemWinSize=32767
ZmodemEscCtl=off
ZmodemLog=off
ZmodemRcvCommand=rz
UseNormalBGColor=on
UILanguageFile=lang\Japanese.lng
BroadcastCommandHistory=on
AcceptBroadcast=on
ConfirmFileDragAndDrop=on
DisablePasteMouseMButton=on
ConfirmChangePaste=on
ConfirmChangePasteCR=on
ConfirmChangePasteStringFile=
ScrollWindowClearScreen=on
PcBoldColor=off
Aixterm16Color=off
Xterm256Color=on
VTReverseColor=255,255,255,0,0,0
EnableBoldAttrColor=on
EnableBlinkAttrColor=on
EnableReverseAttrColor=off
EnableURLColor=on
URLUnderline=on
EnableANSIColor=on
LogBinary=off
LogHideDialog=off
LogIncludeScreenBuffer=off
LogTimestampFormat=%Y-%m-%d %H:%M:%S.%N
LogTimestampType=Local
LogRotate=0
LogRotateSize=0
LogRotateSizeType=0
LogRotateStep=0
DeferredLogWriteMode=on
ScpSendDir=
AutoComPortReconnect=on
WaitCom=off
FileSendHighSpeedMode=on
KmtLongPacket=off
KmtFileAttr=off
KillFocusCursor=on
PrinterCtrlSequence=on
PrnConvFF=off
MouseWheelScrollLine=3
SendBreakTime=1000
YmodemLog=off
YmodemRcvCommand=rb
TranslateWheelToCursor=on
HostDialogOnStartup=on
MouseEventTracking=on
MaximizedBugTweak=2
UnicodeToDecSpMapping=3
AutoScrollOnlyInBottomLine=off
UnknownUnicodeCharacterAsWide=off
AcceptTitleChangeRequest=overwrite
PasteDialogSize=330,220
DisableMouseTrackingByCtrl=on
DisableWheelToCursorByCtrl=on
StrictKeyMapping=off
Wait4allMacroCommand=off
DisableMenuSendBreak=off
ClearScreenOnCloseConnection=off
DisableAcceleratorDuplicateSession=off
AcceleratorNewConnection=on
AcceleratorCygwinConnection=on
DisableMenuDuplicateSession=off
DisableMenuNewConnection=off
PasteDelayPerLine=10
Meta8Bit=off
WindowCtrlSequence=on
CursorCtrlSequence=off
WindowReportSequence=on
TitleReportSequence=empty
EnableLineMode=on
ClearOnResize=on
AlternateScreenBuffer=on
IMERelatedCursor=off
TerminalUID=FFFFFFFF
LockTUID=on
JumpList=on
TabStopModifySequence=on
ClipboardAccessFromRemote=off
NotifyClipboardAccess=on
ClickableUrlBrowser=
ClickableUrlBrowserArg=
LogLockExclusive=on
FontQuality=default
BeepOverUsedCount=5
BeepOverUsedTime=2
BeepSuppressTime=5
MaxOSCBufferSize=4096
JoinSplitURL=off
JoinSplitURLIgnoreEOLChar=\
DebugModes=all
XmodemTimeouts=10,3,10,20,60
YmodemTimeouts=10,3,10,20,60
ZmodemTimeouts=10,0,10,3
TrimTrailingNLonPaste=off
NormalizeLineBreakOnPaste=off
ListHiddenFonts=off
ISO2022ShiftFunction=on
TerminalSpeed=38400
[BG]
BGEnable=off
BGUseAlphaBlendAPI=on
BGSPIPath=plugin
BGFastSizeMove=on
BGFlickerlessMove=on
BGNoFrame=on
BGThemeFile=theme\*.ini
[TTSSH]
Enabled=1
Compression=0
DefaultUserName=
DefaultForwarding=
CipherOrder=78;9:3MK>HJ=GLI<FCDEB026A@?
KnownHostsFiles=ssh_known_hosts
DefaultRhostsLocalUserName=
DefaultRhostsHostPrivateKeyFile=
DefaultRSAPrivateKeyFile=
DefaultAuthMethod=3
LogLevel=0
WriteBufferSize=2097152
LocalForwardingIdentityCheck=1
ProtocolVersion=2
HeartBeat=60
RememberPassword=1
CheckAuthListFirst=0
KexOrder=567:9843210
HostKeyOrder=4567230
MacOrder=@?:861>5;20<=34
CompOrder=3210
EnableRsaShortKeyServer=0
ForwardAgent=0
ForwardAgentConfirm=1
ForwardAgentNotify=1
VerifyHostKeyDNS=1
SSHIcon=Default
DisablePopupMessage=0
X11Display=
UpdateHostkeys=0
GexMinimalGroupSize=0
AuthBanner=1
[TTProxy]
ConnectionTimeout="10"
SocksResolve="auto"
TelnetHostnamePrompt=">> Host name: "
TelnetUsernamePrompt="Username:"
TelnetPasswordPrompt="Password:"
TelnetConnectedMessage="-- Connected to "
TelnetErrorMessage="!!!!!!!!"