使用SecureCRT自带的脚本录制功能。我用的版本是V5.5.3。例子就是之前自动su的部分。
SecureCRT下载地址:http://down.ddvip.com/view/119519362017370.html
建立登录会话并登录服务器
开始录制脚本
Script -> Start Recording Script
输入登录的命令
LANG=en_US.UTF-8
su - username
Password:
结束录制
Script -> Stop Recording Script
把脚本存成你喜欢的名字,例如Script.vbs
设置登录脚本
选中会话,右键Properties -> Connection -> Logon Scripts:
在“Logon scrip”前打钩,选中Script.vbs
Script.vbs脚本如下:
#$language = "VBScript"
#$interface = "1.0"
' This automatically generated script may need to be
' edited in order to work correctly.
Sub Main
crt.Screen.Send "LANG=en_US.UTF-8" & chr(13)
crt.Screen.WaitForString "]$ "
crt.Screen.Send "su - twotwo" & chr(13)
crt.Screen.WaitForString "Password: "
crt.Screen.Send "password" & chr(13)
End Sub
SecureCRT下载地址:http://down.ddvip.com/view/119519362017370.html
建立登录会话并登录服务器
开始录制脚本
Script -> Start Recording Script
输入登录的命令
LANG=en_US.UTF-8
su - username
Password:
结束录制
Script -> Stop Recording Script
把脚本存成你喜欢的名字,例如Script.vbs
设置登录脚本
选中会话,右键Properties -> Connection -> Logon Scripts:
在“Logon scrip”前打钩,选中Script.vbs
Script.vbs脚本如下:
#$language = "VBScript"
#$interface = "1.0"
' This automatically generated script may need to be
' edited in order to work correctly.
Sub Main
crt.Screen.Send "LANG=en_US.UTF-8" & chr(13)
crt.Screen.WaitForString "]$ "
crt.Screen.Send "su - twotwo" & chr(13)
crt.Screen.WaitForString "Password: "
crt.Screen.Send "password" & chr(13)
End Sub