![](/img/trans.png)
[英]SSH from pexpect (pxssh) fails when I try from a linux machine to a windows ssh client server
[英]When I try to use linux expect to ssh remote machine, the authentication is very slow ,why?
我嘗試使用它,但是發現它非常慢。
我的代碼:
#!/usr/bin/expect -f
set hostname [lindex $argv 0]
spawn ssh "xxx\@$hostname"
expect "password: "
send "xxxxx\r"
expect "$ "
send "sudo su admin\r"
expect "assword:\n"
send "xxxxx\r"
expect "$ "
send "cat /tmp/id_rsa.pub >> /home/admin/.ssh/authorized_keys\r"
expect "$ "
send "exit\r"
你有什么建議嗎?
將exp_internal 1
添加到腳本的頂部,以便您可以查看期望的操作。
我懷疑這是錯誤的: expect "assword:\\n"
-我敢打賭實際的密碼提示不以換行符結尾。 嘗試刪除\\n
嘗試
ssh -o GSSAPIAuthentication = no login @ remoteipipaddress
如果成功,則需要編輯/ etc / ssh / ssh_config和/ etc / ssh / sshd_config並尋找GSSAPIAuthentication。 請將值更改為“否”。
它為我工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.