开发者

ssh script gives "key_read" error

开发者 https://www.devze.com 2022-12-23 23:09 出处:网络
I\'m using a script that connects to a cluster through ssh and sends some commands, then quits the connection. This script basically connects once using ssh, then executes a script in this session. Th

I'm using a script that connects to a cluster through ssh and sends some commands, then quits the connection. This script basically connects once using ssh, then executes a script in this session. This script loops through a list of commands a few times and after it is finished, the connection is terminated.

So this script works fine, except for the fact that after a few loops it gives me the following error at loop 22. And then again at loop 32. The loops do exactly the same thing, so I cannot grasp the problem the script is facing. I don't think it is possible for this script to ask for authentication each time he has to run through a loop.

This is the error:

key_read: uudecode AAAAB3NzaC1yc2EAAAABIwAAAQEAxmNx2hcXLpTjuaa3yKC3B9gbF7KprP2/
CH8fBgMbCyIcOB+ZMQDmEnbVTqedBwV/mxjZzorEpHTM8MX2WsTjFsxwzDgcpuxm+3cwfb0WSy9Y4Kb
F8crAsRDbBIpUZ2n/iSdRcds9nTjk6PA开发者_C百科61kTS24RLACHpqF18vudlO5WcbCOnAwa+DdUs0Raw29UiQc
BaC6M4YPnApq9Ayy7a6qFI2uK6efkwfLTZIDivWlIdLpRLEyuBEpozQQhEd0mrGhR/
Gl1GevRvFMms14130xQ4A5UpJSn6CmrRIWBkcgp1TilqDGQ1F5xZOinnc4C00gFrbT3hkkQqY5A9p
node023,10.141.0.31 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxmNx2hcXLpTjuaa3yKC3
B9gbF7KprP2/CH8fBgMbCyIcOB+ZMQDmEnbVTqedBwV/mxjZzorEpHTM8MX2WsTjFsxwzDgcpuxm+
3cwfb0WSy9Y4KbF8crAsRDbBIpUZ2n/iSdRcds9nTjk6PA61kTS24RLACHpqF18vudlO5WcbCOnAw
a+DdUs0Raw29UiQcBaC6M4YPnApq9Ayy7a6qFI2uK6efkwfLTZIDivWlIdLpRLEyuBEpozQQhEd0m
rGhR/Gl1GevRvFMms14130xQ4A5UpJSn6CmrRIWBkcgp1TilqDGQ1F5xZOinnc4C00gFrbT3hkkQqY5
A9pa0lQHFkSw==


Another reason why this problem can happen:

I had a similar issue while SSHing to one of our servers: it would work but display this strange error message. The solution was actually to fix the ~/.ssh/known_hosts which had 2 entries for this server.


I pasted my id_rsa.pub contents from Windows into a Linux VM. That caused CRLFs to be inserted in the middle of the lines in a few places, that were only obvious if I edited the file with a wide enough window (or cat'd in a wide enough terminal). Removing the CRLFs so the entire thing was on one line fixed this issue.


You may be dealing with some time out issues... try adding a sleep into the script to make the loops take longer and see if it still dies on loop 22 and 32... it may just be the timing of when those loops happen. If this is the case you may have to either make adjustments to the sshd configure file on the server you're logging into (if you have access) otherwise you can always add to the ssh configuration on the local computer. Something like "ServerAliveInterval 5" may help.


Hopefully this might help a few people.

I had this exact error message when SSHing to any server. The interesting thing was that I was allowed access still. I checked all the SSH key files and they where all on a single line (which a lot of people reported as a possible cause).

Then I removed the comment from the RSA public (== user@server.com) and it worked! I then removed that line from the DSA public; the error popped up again.

I'm not that knowledgable on SSH keys and how they work exactly, but this seems to have done the trick for a number of servers I access. So remove the comment from RSA public and leave it in for the DSA public.


For me it was a error in the ~.ssh/known_hosts file in my .ssh folder. I deleted all lines to get a "fresh" start of known hosts, and I got no errors after this.


I saw this online: http://support.bb4.com/archive/200408/msg00235.html

Looked similar to your problem. There is another link in the post to more detailed info on Big Brother's website.


For me, I had a public key for one server spread over multiple lines due to copypasta. Putting the entire key onto a single line resolved this error.

0

精彩评论

暂无评论...
验证码 换一张
取 消