Hello sudo su what does?
you can use sudo to run commands as other user, but sudo su not sure what will do if you want to run a command as root, vargrant usually does, so you could remove that. Try: (note -l next to bash) *#!/usr/bin/env bash -l* *sudo -E -H apt-get -y install sshpass* *sshpass -p 'password' ssh -o StrictHostKeyChecking=no [email protected] <[email protected]> <<EOF* *#some commands go here* *exit* *EOF* *Thanks* *Alvaro.* On Wed, Feb 24, 2016 at 6:11 AM, Pavel Lautsevich <[email protected]> wrote: > I need to connect via SSH to a remote host when a virtual machine starts, > run there some commands and close the connection. I'm trying to do it using > the following bootstrap.sh script: > > *#!/usr/bin/env bash* >> *sudo su* >> *apt-get install sshpass* >> *sshpass -p 'password' ssh -o StrictHostKeyChecking=no >> [email protected] <[email protected]>* >> *#some commands go here* >> *exit* >> > > The system responds: > > >> >> >> >> *==> default: Pseudo-terminal will not be allocated because stdin is not >> a terminal.The SSH command responded with a non-zero exit status. >> Vagrantassumes that this means the command failed. The output for this >> commandshould be in the log above. Please read the output to determine >> whatwent wrong.* >> > > The command "sshpass -p 'password' ssh -o StrictHostKeyChecking=no > [email protected]" works well when i type it after manual > "vagrant ssh". > > What am I doing wrong? > > I would be grateful for any advice! > > -- > This mailing list is governed under the HashiCorp Community Guidelines - > https://www.hashicorp.com/community-guidelines.html. Behavior in > violation of those guidelines may result in your removal from this mailing > list. > > GitHub Issues: https://github.com/mitchellh/vagrant/issues > IRC: #vagrant on Freenode > --- > You received this message because you are subscribed to the Google Groups > "Vagrant" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/vagrant-up/91fdc505-50e9-4b29-af21-d429c19b634d%40googlegroups.com > <https://groups.google.com/d/msgid/vagrant-up/91fdc505-50e9-4b29-af21-d429c19b634d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/mitchellh/vagrant/issues IRC: #vagrant on Freenode --- You received this message because you are subscribed to the Google Groups "Vagrant" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAHqq0eyRfgqhV8yMv_avJVW5yYzYZYRkG26J%3DC7_T-ZCDCFdqA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
