securecrt logon script sudo 自動登陸

本人使用securecrt登陸服務器,每次須要sudo su - deploy操做,輸入密碼,效率很低.
還好,securecrt自己的logon script能夠支持咱們鏈接到服務器後,發送一些命令來執行.python

設置方式如圖:
服務器

Python腳本以下:code

# $language = "python"
# $interface = "1.0"
def main():
    crt.Screen.Synchronous = True
    crt.Screen.Send("echo 'Zcq@5123!@#$' | sudo -S ls\r")
    crt.Screen.Send("sudo su - deploy\r")
    crt.Screen.Send("clear\r")

    crt.Screen.Synchronous = False
main()
相關文章
相關標籤/搜索