I have setup key-less login at a remote server. I use the remote server for tunneling my data. I want my local system to ssh into the remote server at boot time automatically.
I tried the solutions suggested in the following links but none of them worked for me:
I did what was mentioned in those posts. The autossh
command should open a port (9090
in my case) so that I can tunnel my traffic. After applying each of those methods, I restarted the PC and upon reboot I ran nmap
to see if the particular port was listening or not. Sadly, in each case the port was still closed so I have to manually enter the command at terminal every time I reboot my PC.
Can some one help me? Do note that the remote server and my local system are both running Ubuntu 14.04, and the local system has no GUI installed.
I have this little script kept in ~/bin/infinite_ssh
(1):
#! /bin/bash -x
#
while :; do
ssh -R 2222:localhost:22 remoteserver sleep 86400
sleep 10
done
this is connecting to the remoteserver
and creates a backward tunnel so that in the remote server I can ssh my desktop by using ssh -p 2222 localhost
. Your application may, obviously, vary. The remoteserver
is defined in ~/ssh/config
so that you can login without a password, and has KeepAlive on
option.
Then you can call it from /etc/rc.local
with
su -l youruser -c /home/youruser/bin/infinite_ssh &
so that it starts as your user at boot time, in background.
Footnotes:
(1) obviously, you need to give the script execution permission... chmod a+x ~/bin/infinite_ssh
.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다