Is there any way to give input to background processes or which run as daemon processes?

I was coding some Puppet configuration files and I had to push them to some remote machine. For that purpose I used git.

So I created a bare repository on that remote machine and used a git hook which would update the file after each push. So to update in /etc/puppet of the server machine I need to authenticate as root of that machine... But git essentially does this transfer through SSH (in the background ).

I tried to use /bin/expect to provide username and password for root of the remote machine but it didn't work.

  • 4
    I'm sorry I'm not understanding exactly what you're doing or what you're not managing to do. Could you give an example/commands you're running maybe so we get a more concrete idea of the task at hand? – Mat Jul 26 '12 at 6:18
  • see stackoverflow.com/a/4869937/309483 – Janus Troelsen Jul 26 '12 at 15:36

Although this doesn't exactly answer the question you asked, you presented us with an XY Problem.

The answer to your real problem is to set up SSH keys.

  • On the client side run ssh-keygen as the user who will be performing the operation.
  • Copy the contents of id_rsa.pub to ~/.ssh/authorized_keys on the server.
  • Make sure ~/.ssh/ is mode 0700 on the server.

You will no longer need to enter a password to connect.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.