Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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 need to start a ssh connection to a proxy in order to have access to some resources.

I have written the shell script and managed to run the script successfully.

However, I found it very inconvenient to run it every time I need to use it.

The best I think I should have is run the script in machine startup.

But I have one problem:

After my machine connects with the proxy, the proxy requires me to input the password in order to authenticate.

But how can I tell the shell to "input" the password for me, so I do not need to type it?

Any hint?


set timeout 60
spawn /usr/bin/ssh -D 22 -g name@ssh.sshcenter.info
expect {
"password:" {
send "*******\r"
interact {
timeout 60 { send " "}

Then use expect command to execute the script.

Very nice.

share|improve this question
up vote 3 down vote accepted

You need to use a keypair for authentication and don't specify a password for your private key. There are many tutorials for this on the web.

share|improve this answer
Unfortunately, the remote server is quite stringy on the command.I do not even have access to command like cp. So I think I failed to do that. Actually, the remote server is just proxy for the users to have access to some specific Internet resources. Thanks any way, I learned something new. :-) – xiaohan2012 Nov 8 '11 at 4:14

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.