VMware Cloud Community
kalEl00
Contributor
Contributor

Issue running SSH command with sudo

All,

When I try to run the SSH command workflow with sudo, it just hangs and never finishes. I tried running it multiple times but the same result. I have to go in and manually cancel it. Tried waiting up until 15 mins, but no result.

I read somewhere that by disabling “Defaults requiretty” on the ssh target system, this should go away, but it didn’t.

Attached is a screenshot of the command I am trying to run. SSH plugin version is 2.0.0.536

Any other ideas?

0 Kudos
3 Replies
stvkpln
Virtuoso
Virtuoso

0 Kudos
kalEl00
Contributor
Contributor

So, both those methods seem to have done something, but not resolved it completely. In other words, previously i was getting a failure when I ran the workflow, but now, the workflow just seems to hang around on the 'execute' step (I added session.pty = true)

the flow never finishes... screenshot in my first post.

I was also able to recreate the same scenario in my lab. So, that rules our environment issues.

Basically, I want to run a command like 'sudo su - oracle; /path_to_script/scrip.sh' .... but it just hangs.

Have you seen this before? Is this a bug?

Thanks.

0 Kudos
igaydajiev
VMware Employee
VMware Employee

sudo su - oracle; /path_to_script/scrip.sh


using ';' will open new shell and probably will make vCO to hang.

instead you need to use something like


>sudo -n su someuser -c "/path_to_script/scrip.sh"


check this post.

https://communities.vmware.com/thread/483606

Since SSH plugin does not support interactive sessions when testing add -n option to sudo command for better troubleshooting.

-nThe -n (non-interactive) option prevents sudo from prompting the user for a password. If a password is required for the command to run, sudo will display an error message and exit.

As described in above file you need to edit sudoers file to allow the user who is issuing the sudo commands to NOT be asked for a password when executing a command.

http://askubuntu.com/questions/334318/sudoers-file-enable-nopasswd-for-user-all-commands



0 Kudos