Three types of connectionsThere 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
Telnet connections Quote:
connect 'myserver:23 /nossh'
or
Quote:
connect 'myserver:23 /telnet'
or
Quote:
connect 'myserver:23'
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.
SSH connections Quote:
connect 'myserver /ssh'
This way will start SSH connection without defining whether SSH1 or SSH2 has to be used.
Quote:
connect 'myserver /ssh /1'
or
Quote:
connect 'myserver /ssh /2'
Parameters
/1 and
/2 force to use SSH1 or SSH2 method.
Quote:
connect 'myserver /ssh /auth=password /user=username /passwd=password'
or
Quote:
connect 'myserver /ssh /1 /auth=password /user=username /passwd=password'
or
Quote:
connect 'myserver /ssh /2 /auth=password /user=username /passwd=password'
or
Quote:
connect 'myserver /ssh /auth=publickey /user=username /passwd=password /keyfile=private-key-file'
or
Quote:
connect 'myserver /ssh /1 /auth=publickey /user=username /passwd=password /keyfile=private-key-file'
or
Quote:
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. Quote:
connect 'myserver /ssh /auth=password /user=username /ask4passwd'
or
Quote:
connect 'myserver /ssh /1 /auth=password /user=username /ask4passwd'
or
Quote:
connect 'myserver /ssh /2 /auth=password /user=username /ask4passwd'
or
Quote:
connect 'myserver /ssh /auth=publickey /user=username /ask4passwd /keyfile=private-key-file'
or
Quote:
connect 'myserver /ssh /1 /auth=publickey /user=username /ask4passwd /keyfile=private-key-file'
or
Quote:
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 Quote:
connect '/C=x'
Here
x represents COM port number. For example to connect via COM port 1 the command will look like:
connect '/C=1'About setsyncIt is highly recommended to use the macro command
Quote:
setsync 1
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.