Jump to content
Sign in to follow this  
prost

How to write a password-entering ssh script?

Recommended Posts

I use an ssh tunnel which needs a password, where the characters entered are not displayed. I tried different methods:

 

#!/bin/bash

sh -c "password" | ssh -L 6700:127.0.0.1:4888 user@sshtunnel.net

 

#!/bin/bash

ssh -L 6700:127.0.0.1:4888 user@sshtunnel.net

sh -c "password"

 

I tried 'echo "password" | ssh -L 6700:127.0.0.1:4888 user@sshtunnel.net' but this only works where password characters are displayed.

 

The technical support guy said that the ssh server won't allow public-key placement because of vulnerabilities of openssl.

 

Incidentally, it always says "#!/bin/bash: no such file". I checked: it is there.

 

I also tried to change the algorithms:

ssh -c aes128-ctr, aes192-ctr, aes256-ctr, aes128-cbc, cast128-cbc, arcfour128, arcfour256, arcfour, aes192-cbc, aes256-cbc, 3des-cbc

but it always says there's a problem resolving the second algorithm.

Share this post


Link to post
Share on other sites

man expect

 

wrap your ssh connection in expect ... expect can enter a password for you

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...