There are 3 types of connection you can establish from TeraTerm macro:
- Telnet connection (port 23)
- SSH1 or SSH2 connection (port 22)
- Connection via COM port
orconnect 'myserver:23 /nossh'
orconnect 'myserver:23 /telnet'
Using /nossh is strongly recommended. Without this parameter TeraTerm will start connecting with the same method (telnet or SSH) that was used during last time when teraterm.ini file was saved. In case it was SSH than macro will try to connect via SSH and will eventually fail.
connect 'myserver /ssh'
This way will start SSH connection without defining whether SSH1 or SSH2 has to be used.
orconnect 'myserver /ssh /1'
connect 'myserver /ssh /2'
Parameters /1 and /2 force to use SSH1 or SSH2 method.
orconnect 'myserver /ssh /auth=password /user=username /passwd=password'
orconnect 'myserver /ssh /1 /auth=password /user=username /passwd=password'
orconnect 'myserver /ssh /2 /auth=password /user=username /passwd=password'
orconnect 'myserver /ssh /auth=publickey /user=username /passwd=password /keyfile=private-key-file'
orconnect 'myserver /ssh /1 /auth=publickey /user=username /passwd=password /keyfile=private-key-file'
connect 'myserver /ssh /2 /auth=publickey /user=username /passwd=password /keyfile=private-key-file'
Above 6 ways allow to skip popup dialog and pass username and password directly from macro. Please note that /auth=password or /auth=publickey is the parameter saying that authentication will be done by entering password or key-file thus you should not replace the word 'password' or the word 'publickey' in it with actual values. Only the words shown above with italic font have to be substituted.
Please remember that entering actual username and password in TeraTerm macro will cause them to be stored as an open text and it is your responsibility to keep such macros in secure place.
A little bit better practice is to use getpassword and passwordbox commands that store encrypted passwords in the file.
orconnect 'myserver /ssh /auth=password /user=username /ask4passwd'
orconnect 'myserver /ssh /1 /auth=password /user=username /ask4passwd'
orconnect 'myserver /ssh /2 /auth=password /user=username /ask4passwd'
orconnect 'myserver /ssh /auth=publickey /user=username /ask4passwd /keyfile=private-key-file'
orconnect 'myserver /ssh /1 /auth=publickey /user=username /ask4passwd /keyfile=private-key-file'
connect 'myserver /ssh /2 /auth=publickey /user=username /ask4passwd /keyfile=private-key-file'
Above 6 ways pass username and authentication method directly from macro, and the popup asks for password.
Connections via COM port
Here x represents COM port number. For example to connect via COM port 1 the command will look like: connect '/C=1'
It is highly recommended to use the macro command
right after the command connect. This command switches TeraTerm into synchronous communication mode in which the buffer never overflows. See TeraTerm Macro help for more details.