2

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?

Solution:

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.

3

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.

  • 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 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.