Skip to content
Advertisement

“Name or service not knownname” using SSH from script [closed]

Cannot connect to host by SSH.

I am using following shell script to use ssh.

JavaScript

But It always says : Name or service not knownname c15-0330-14.ad.mtu.edu.

I tried ssh c15-0330-14.ad.mtu.edu. It works. Also, If I have several hosts, how can I invoke them one by one?

Advertisement

Answer

The error message should be

JavaScript

except the DOS line endings in your script cause an extra carriage return to be stored at the end of the value of host_list. This carriage return, when printed as part of the error message, causes the cursor to return to the beginning of the line, resulting in the error message you actually see. Notice how the two halves line up (the carriage return immediately precedes the colon):

JavaScript

results in your error of

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement