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

考试

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

公考旅游

昨天是一年一度的浙江省公务员考试的日子,我也多了个借口到温州玩2天。 来之前早早的计划好了行程……没想到天有不测风云,同学开得披萨店没吃到,大学城故地重游也没去。 最后,两天半的时间和同学去了3次KTV...还是同一批人- -! ps:公务员对我来说就是个旅游的机会,2月前的国考让我去杭州玩了2天,为划船去了3次西湖但是都未能如愿……今年年底继续~