Skip to main content

auto input pwd while ssh

As ssh became my first choice for going over GFW, a auto connected ssh tunnel is badly required.

what i did for a long time is adding a application launcher whose property is set as "ssh -D port usr@host" to the panel. the tunnel will be established with one click and some pwd typing.

I googled and find EXPECT.

Step One:
$sudo apt-get install expect
Step Two:
$vim ssh //create a new script.
Step Three:
//Input in Vim
#!/usr/bin/expect
spwan ssh -D port usr@host;
expect "*password:";
send "pwd\r";
interact;
//{esc};:wq;{enter} to save the file.
Step Four:
$chmod +x ssh
Step Five:
./ssh

Now the script will connect to ssh server automatically without requiring the pwd.

Comments

Popular posts from this blog

BACK HERE!

it has been a long time Since 2006 i set my blog at blogspot.com. i have tried other services such as wordpress, typecho, hexo, hugo etc because google had been blocked in 2008. Just tired of buying vps,install database and install blog applications. Get back here to stay simple.

aes,gpg,encrypt, man etc

-Who is the most controversial man in the world recently? -Definitely it's Julia Assange . WikiLeaks had released a package of file encrypted with AES. What shall we do right now? yeah! download it and wait for the passphrase! So let's have a little try at encrypting in Ubuntu. GPG  here is sample file another_file. 1.gpg -c filename enter a passphrase.Now the file is encrypted. 2.gpg filename.gpg AES     Download AESCrypt here.     extract the package with         tar xzvf filename     then         make         sudo make install     I haven't tried aescrypt yet. But you can make it with a simple command. Just go to their home page. Others things: Chinese man page. while downloading source file of aescrypt, i found that they provide a manpage file. So making 'man aescrypt' working in terminal became a problem. After goo...

考试

公考成绩出了...发挥很稳定,和大四第一次考的成绩一样。排名23,还不错,今年有好好复习的动力了。 本周考职称外语,四月份考会计从业资格证,五月的计算机中级不知道要不要报名.. 今年肯定是考试的一年。