Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to do something like this

ssh user@remote-domain.com ./remote_script.sh

Contents of remote_script.sh

hg pull

This example is much simpler than what I am actually doing. I know I can pass shell commands directly over ssh, but assume I want to run a remote script. Also I know Mercurial has hooks, but ignore that as well, I am only using Mercurial as an example here for brevity.

This is what I expect to happen, a password prompt for the user:

user@repository-domain.com password: 

This is the output:

ssh user@remote-domain.com ./remote_script.sh
remote: Permission denied, please try again.
remote: Permission denied, please try again.
remote: Permission denied (publickey,password).
abort: no suitable response from remote hg!

The remote shell session seems to be feeding something to the password input prompts and failing after 3 automated tries. I would really like the prompt to reach my local shell session. Perhaps that isn't possible.

I don't want to give the remote server key authentication to the repository, I'd prefer the user be prompted each time. Is there any way to do this?

share|improve this question
possible duplicate of How to run mutt via ssh without going through an interactive shell – Gilles May 4 '12 at 23:18
up vote 7 down vote accepted

It's hard to figure out what exactly is going on from this post. Is the password prompt being printed by the hg command (I'm not familiar with hg)?

I recommend you try adding the -t option to ssh:

ssh -t user@remote-domain.com ./remote_script.sh
share|improve this answer
The -t option seems to do what I want. Thank you. – Matthew Chambers May 4 '12 at 17:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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