Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: SSH Tunnels on startup

  1. #11
    Join Date
    Feb 2007
    Beans
    20

    Re: SSH Tunnels on startup

    I mean I already have rsa keys setup in my /home/username/.ssh/id_rsa and I can successfully make the ssh connection without entering any password. Does specifying the file with the -i option change the behavior any more than it already is?

    Also, is there any place to put the commands that will guarantee the network has already been loaded on startup? Does rc.local already guarantee that? I thought that my be an issue because the ssh commands won't work if there is no network setup already.

  2. #12
    Join Date
    Aug 2008
    Beans
    488

    Re: SSH Tunnels on startup

    Probably the -i works because when you boot up your system and rc.local will be executed, I think it will be done as root, and that is not where the keys are stored, so the "-i" Lars proposed do add some weight.

    The ssh commands after each other will not be run nested, but in sequence. The "&" will spawn the process to the background so that you don't have to wait for it to return ... which it shouldn't since the tunnel should be up as long as your computer is up ... What you could do for troubleshooting purposes you can add temporarily add debug info to your ssh connections like

    Code:
    ssh -v -i keys -L 8000:net1:8001 user2@net2 > /tmp/normal.out 2> /tmp/error.out &
    That should redirect all normal output (which is verbose thanks to the -v) to the file /tmp/normal.out and all errors to ... error.out

    That should provide clues about ssh actually being started and what it is doing while you don't have any sight on it.

    Happy regards

  3. #13
    Join Date
    Apr 2006
    Beans
    1

    Talking Re: SSH Tunnels on startup

    Another good alternative is installing gstm (Gnome SSH Tunnel Manager) and add it to your startup programs.

    The tunnel is more visually active this way (with a tray icon)

    My only problem at the moment is gnome is asking me for the keyring password upon startup which prevents the network from starting before I enter it,
    because of this the tunnel won't start either because there is no network available yet.

    But I'm sure I'll have that fixed soon

  4. #14
    Join Date
    Apr 2008
    Location
    Berlin
    Beans
    72
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: SSH Tunnels on startup

    This is a very old thread, but since i was looking also for the answer and i found i somewhere else, than i copy it there.
    It seems (on my ubuntu 12.04) that rc.local is executed before the network is on. Just add a delay of a few seconds in the script
    Code:
    sleep 20
    solved the problem for me.

  5. #15
    Join Date
    May 2010
    Beans
    1

    Re: SSH Tunnels on startup

    Why not use autossh? Here's a startup script for autossh that allows you to start/stop multiple tunnels: http://surniaulula.com/2012/12/10/au...tiple-tunnels/

    js.

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •