VMware Cloud Community
deepthy
Enthusiast
Enthusiast
Jump to solution

SSH command from orchestrator using SSH plug-in

I have generated the key pair and also registered the public key on host using the workflows in the SSH plugin. Now when I try to execute a ssh command from the workflow, I see the following error -

"Unable to execute command InternalError: SSH_MSG_DISCONNECT: 2 Too many authentication failures for root  (Workflow:Run SSH command / Execute SSH Command (item6)#16) (Workflow:Run SSH command / Execute SSH Command (item6)#33)

Also, the session gets created and I am able to see the SessionID.

Please help me fix this.

0 Kudos
1 Solution

Accepted Solutions
deepthy
Enthusiast
Enthusiast
Jump to solution

Solved -

After a lot of trial and error I found the solution.

The SSH keys generated had to be of 1024 key size and the username with which the keys are registered on the host can only be used to execute commands as well.

View solution in original post

0 Kudos
9 Replies
abhilashhb
VMware Employee
VMware Employee
Jump to solution

Hi Deepthy,

Welcome to the community.

This is usually caused by inadvertently offering multiple ssh keys to the server. The server will reject any key after too many keys have been offered.

You can see this for yourself by adding the -v flag to your ssh command to get verbose output. You will see that a bunch of keys are offered, until the server rejects the connection saying: "Too many authentication failures for [user]". Without verbose mode, you will only see the ambiguous message"Connection reset by peer".

Check sshd_config and verify that root login is permitted. sshd will need to be restarted if the setting changes.

Abhilash B
LinkedIn : https://www.linkedin.com/in/abhilashhb/

deepthy
Enthusiast
Enthusiast
Jump to solution

Hi Abhilash,

Appreciate your quick help!

Now I am able to execute "uptime" command using the SSHCommand but still see the same error with SSHSession.

Can you please help me understand the differences between these?

0 Kudos
abhilashhb
VMware Employee
VMware Employee
Jump to solution

AFAIK SSHSession is used to establish the session to a SSH host and after that SSHCommand can be run to run a specific command against the host. Not entirely sure if its right.

But i remember one of my colleagues facing this error while connecting to a SSH host. We searched a lot of documentation and found out that the host was not enabled to be paired so we had to make some changes in the config file of the host.

So can you look at something on those lines?

See if this link helps.

And also see if the command that you try to execute through vCO are legit commands by running them through a SSH session to the host.

Abhilash B
LinkedIn : https://www.linkedin.com/in/abhilashhb/

0 Kudos
deepthy
Enthusiast
Enthusiast
Jump to solution

One difference between SSHSession and SSHCommand is that SSHSession can be created with sshkeys but the SSHCommand expects a password.

That is why I was able to execute commands with SSHCommand.

Can you please let me know if there are any configurations that need to be done to get this plug-in working.

The following are the steps I followed,

     Added the host to the inventory and also created a new root folder.

     Generated key pair using vco default workflow

     Registered the vco public key on the host.

Please let me know if I am missing anything

0 Kudos
abhilashhb
VMware Employee
VMware Employee
Jump to solution

Have you added the entry for vCO host on the target server so that it can send SSH commands. Like under ~/.ssh/known_hosts

Abhilash B
LinkedIn : https://www.linkedin.com/in/abhilashhb/

0 Kudos
deepthy
Enthusiast
Enthusiast
Jump to solution

My aim to to automate the execution of some scripts on various servers. I cannot manually add the vco host on each of these servers.

Is there a way to do it as the part of automation?

And more over, to understand the problem and the ssh plugin better I am just using the vco server as the target server

0 Kudos
deepthy
Enthusiast
Enthusiast
Jump to solution

Solved -

After a lot of trial and error I found the solution.

The SSH keys generated had to be of 1024 key size and the username with which the keys are registered on the host can only be used to execute commands as well.

0 Kudos
abhilashhb
VMware Employee
VMware Employee
Jump to solution

Glad to hear the issue was resolved 🙂 please close the thread by choosing correct/helpful answers so others can refer this in future.

Abhilash B
LinkedIn : https://www.linkedin.com/in/abhilashhb/

0 Kudos
jinhoe
Enthusiast
Enthusiast
Jump to solution

I managed to resolve it by excluding the following special characters from the password.
#@!|"\'

0 Kudos