Jacques44 / node-red-contrib-bigssh

remote command using ssh big node
Apache License 2.0
8 stars 12 forks source link

"Error: All configured authentication methods failed" #30

Closed My-Random-Thoughts closed 2 years ago

My-Random-Thoughts commented 2 years ago

I got #29 working (thank you), but I am getting the above error when using different hosts with different credentials.

I have several credentials setup (see image) and I your BIGSSH node has the first one selected as default. image

When I run my cdoe (below) I am getting the above error message. If I select one of the others, I don't as they all happen to have the same username/password. The first does not.

Am I missing something simple?

[{"id":"28b3676.057c198","type":"function","z":"da204325.2b65f","name":"Split","func":"nodes = [\n \"rhasspy-lounge\",\n \"rhasspy-kitchen\",\n \"rhasspy-study\",\n \"noticeboard\"\n]\n\nnodes.forEach(item => {\n node.send({\n \"topic\": item,\n \"config\": { \"host\": item }\n });\n});\n\nnode.done();\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":190,"y":380,"wires":[["b8df25e4.08a3c8"]]},{"id":"b8df25e4.08a3c8","type":"delay","z":"da204325.2b65f","name":"Delay","pauseType":"rate","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":330,"y":380,"wires":[["9d1dcc4e.f5e7e"]]},{"id":"9d1dcc4e.f5e7e","type":"bigssh","z":"da204325.2b65f","name":"Get Temp","commandLine":"sensors | grep temp1 | cut -c 16-19","commandArgs":"","minError":1,"minWarning":1,"noStdin":true,"format":"utf8","payloadIsArg":false,"myssh":"c4fb131c.4ec04","x":480,"y":380,"wires":[["ea94db9e.c1ad08"],["53ad063.f45f6f8"],["c2e5ef8.42b751"]]},{"id":"ea94db9e.c1ad08","type":"debug","z":"da204325.2b65f","name":"TEMP","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":650,"y":320,"wires":[]},{"id":"c2e5ef8.42b751","type":"debug","z":"da204325.2b65f","name":"STDERR","active":false,"tosidebar":false,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":660,"y":440,"wires":[]},{"id":"f6016221.8126c","type":"inject","z":"da204325.2b65f","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":170,"y":340,"wires":[["28b3676.057c198"]]},{"id":"53ad063.f45f6f8","type":"debug","z":"da204325.2b65f","name":"STATUS","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":660,"y":380,"wires":[]},{"id":"c4fb131c.4ec04","type":"SSH_Credentials","host":"lnx-automation","port":"22","userlabel":"automan@lnx-automation"}]

Jacques44 commented 2 years ago

Hello, sorry for answering so late.

Why don't you use a bigssh node for each host you need to hit?

My-Random-Thoughts commented 2 years ago

No worries on lateness, we all have other lives :)

I want to run command on a lot of hosts (20+) and would rather do it in a function loop than have one node for each. It would allow me to make a quick change to add/remove hosts as well as the command I execute.

Jacques44 commented 2 years ago

Ok well understood :-)

So I've made a special release for you with an highly experimental code ! You can check 1.2.9 right now.

I've modified your split code to:

nodes.forEach(item => {
 node.send({
 "topic": item,
 "config": {"uhcred": item}
 });
});

Please tell me

My-Random-Thoughts commented 2 years ago

Trying this version with your code change results in the following error: {"message":"Unavailable configuration for uhcred rhasspy-lounge"} I get one for each entry in the loop

Thank you

Jacques44 commented 2 years ago

You need to loop over full credential labels which are @.***

On 3 Aug 2021, at 19:48, My Random Thoughts @.***> wrote:

Trying this version with your code change results in the following error: {"message":"Unavailable configuration for uhcred rhasspy-lounge"} I get one for each entry in the loop

Thank you

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Jacques44/node-red-contrib-bigssh/issues/30#issuecomment-892040672, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEKS6M7PJUCAZWTX2FSMR2DT3ATV5ANCNFSM5ASRFSIQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email.

My-Random-Thoughts commented 2 years ago

Ah, thanks. It now works perfectly. Thank you.

EDIT: Scratch that, it looks like it's using one connection no matter what I give it. Running the command hostname returns the same result every time.

EDIT 2: I have two NR environments. One works, the other doesn't??!! They are both on the same docker host using the same docker image.

My-Random-Thoughts commented 2 years ago

When in doubt, turn it off and on again. It's all working for me, thank you.