Re: bosh ssh sudo commands


Marco Voelz
 

Dear Fabian,

your problem might be the same as seen in this github issue: https://github.com/cloudfoundry/bosh/issues/964<https://github.com/cloudfoundry/bosh/issues/964#event-420594944>

`bosh ssh` sets up users which need a password to execute `sudo`. Therefore, you would need to provide the password on the commandline in which you want to execute the command, just as Dmitriy answered in the github issue.

Until the users are setup with password-less sudo, this is pretty much the best you can do, I guess.

Warm regards
Marco

On 28/09/15 07:32, "Schwarz-Fritz, Fabian" <fabian.schwarz-fritz(a)sap.com<mailto:fabian.schwarz-fritz(a)sap.com>> wrote:

Hi bosh-freaks,

I do have a technical bosh question regarding bosh ssh . I am curious if you do have any solutions to the problem below or ideas for alternative. Please let me know in case this is the wrong mailing list.

I am currently trying to automate the recovery of an existing snapshot. The snapshot is a backup for a my own bosh-release for a database technology. The boshrelease will have OpenStack as IaaS. I am using several cinder/nova commands (Openstack specific) and then I want to execute several commands on the bosh-vm. Therefore I do need to execute several commands on the bosh-VM where the database is running from the host VM.

In order to do that, I am using bosh ssh "<command>" for example

bosh ssh mongodb/0 “echo blub”

This is working perfectly fine. However, when I automate the recovery a backup, there are a few commands that do need root access. One command could be this one, for example:

bosh ssh mongodb/0 "sudo mount -t ext4 /dev/vdc1 /var/vcap/store_snapshot”

Unfortunately, this is not working. I get a error

sudo: no tty present and no askpass program specified

Does anyone have any help/ideas on how to solve this issue?
Am I using bosh ssh in the wrong way?
Is bosh ssh not made to execute such commands?
Can I solve this by writing an errand and calling the errand in automation script?

I am happy about every idea that helps me solving this issue or letting me better understand the problem.

Thanks a lot in advance,
Cheers,
Fabian

Join cf-bosh@lists.cloudfoundry.org to automatically receive all group messages.