Re: [gentoo-user] Keep alive within SSH session
On 07/17/2016 11:03 AM, lukash wrote: > On Sun, 2016-07-17 at 18:47 +0100, Mick wrote: >> On Sunday 17 Jul 2016 14:14:42 you wrote: >>> On Sun, 17 Jul 2016 17:35:55 +0100 >>> Mick wrote - >>> On Sunday 17 Jul 2016 16:20:30 Ralf wrote: > On 07/17/2016 04:02 PM, Mick wrote: >> I am not sure of the correct approach to achieve a prolonged >> remote= >> >> debugging session through SSH and avoid the SSH session >> timing out.= >>> >>> What you need is expect or Expect or pexpect depending on your base >>> scripting language preference - tcl, perl, or python. >>> >>> Dave F >> >> Thank you Dave! I'm emerging dev-tcltk/expect as I type >> this. Hopefully the >> learning curve won't be too steep. ;-) > > You may also wanna try the ServerAliveInterval option in your client's > ssh config. It sends some keepalive data to the server every X seconds, > sounds like what you need. > Please let me know if you have any issues. I'm not an expert in Tcl (or expect), but I help maintain the package and it's recently had bugs that I attempted to fix, so let me know how it works out if you decide to go that way. -- Daniel Campbell - Gentoo Developer OpenPGP Key: 0x1EA055D6 @ hkp://keys.gnupg.net fpr: AE03 9064 AE00 053C 270C 1DE4 6F7A 9091 1EA0 55D6 signature.asc Description: OpenPGP digital signature
Re: [gentoo-user] Keep alive within SSH session
Am 2016-07-17 um 16:02 schrieb Mick: If I continue to run (router) commands on the terminal, while the debugging is running, the SSH time out is postponed. What do you suggest I try on an SSH terminal from my PC to keep running recurring commands after I have connected to the router? I will need to keep a debugging session going for some hours, in order to collect the data I'm after. one more suggestion: autossh
Re: [gentoo-user] Keep alive within SSH session
> Am 17.07.2016 um 16:02 schrieb Mick : > > I am not sure of the correct approach to achieve a prolonged remote debugging > session through SSH and avoid the SSH session timing out. > > This is what I try to achieve: > > I login into a router with SSH from my PC. Then I can run certain commands to > start and monitor a debugging session in the router. However, if I leave > alone the SSH session, it will soon time out. The debugging only runs while > the session is live. Exiting the SSH session causes all debug output to be > lost. > > If I continue to run (router) commands on the terminal, while the debugging is > running, the SSH time out is postponed. > > What do you suggest I try on an SSH terminal from my PC to keep running > recurring commands after I have connected to the router? I will need to keep > a debugging session going for some hours, in order to collect the data I'm > after. I do this with a combination of "mosh" and "tmux". That works perfectly. It even can catch disconnected DSL or Wifi. Christian -- Erlenwiese 14, 36304 Alsfeld T: +49 6631 78823400, F: +49 6631 78823409, M: +49 171 9905345 USt-IdNr.: DE225643613, https://www.roessner-network-solutions.com signature.asc Description: Message signed with OpenPGP using GPGMail
Re: [gentoo-user] Keep alive within SSH session
On Mon, Jul 18, 2016 at 12:02 AM, Mick wrote: > I am not sure of the correct approach to achieve a prolonged remote > debugging > session through SSH and avoid the SSH session timing out. > > This is what I try to achieve: > > I login into a router with SSH from my PC. Then I can run certain > commands to > start and monitor a debugging session in the router. However, if I leave > alone the SSH session, it will soon time out. > Have you checked the router config for a session timeout? Eg on a Cisco you may have something like; ssh timeout 30 Often setting this to 0 will disable the timeout, but RTFM.
Re: [gentoo-user] Keep alive within SSH session
* Mick [160717 12:36]: > On Sunday 17 Jul 2016 16:20:30 Ralf wrote: > > On 07/17/2016 04:02 PM, Mick wrote: > > > I am not sure of the correct approach to achieve a prolonged remote > > > debugging session through SSH and avoid the SSH session timing out. > > > > > > This is what I try to achieve: > > > > > > I login into a router with SSH from my PC. Then I can run certain > > > commands to start and monitor a debugging session in the router. > > > However, if I leave alone the SSH session, it will soon time out. The > > > debugging only runs while the session is live. Exiting the SSH session > > > causes all debug output to be lost. > > > > Take a look at screen or tmux. man screen, man tmux. > > Thank you Ralph, but detaching the *local* terminal process of SSH does not > in > any way stop the login session on the router from timing out. > > > > > If I continue to run (router) commands on the terminal, while the > > > debugging is running, the SSH time out is postponed. > > > > you may also want to tweak some timeout options in your sshd_config > > The router login times out unless some command is fed into the login session > a > the time. So, I'll need to be able to run commands every so often on the > router shell from within my SSH session (without sitting in front of my PC > terminal of course). The commands 'watch', or 'at' might do it, but I am not > sure if some script is necessary for this. > > -- > Regards, > Mick if you just want something to keep the connection open how about just a simple shell command in a whole loop? e.g., while true; do clear; ps aux | grep whatever; sleep 5; done
Re: [gentoo-user] Keep alive within SSH session
The proper solution is to use TCP keep alive to prevent tunnel over tunnel issues from arising.
Re: [gentoo-user] Keep alive within SSH session
On Sun, 2016-07-17 at 18:47 +0100, Mick wrote: > On Sunday 17 Jul 2016 14:14:42 you wrote: > > On Sun, 17 Jul 2016 17:35:55 +0100 > > Mick wrote - > > > > > On Sunday 17 Jul 2016 16:20:30 Ralf wrote: > > > > On 07/17/2016 04:02 PM, Mick wrote: > > > > > I am not sure of the correct approach to achieve a prolonged > > > > > remote= > > > > > > > > > > debugging session through SSH and avoid the SSH session > > > > > timing out.= > > > > What you need is expect or Expect or pexpect depending on your base > > scripting language preference - tcl, perl, or python. > > > > Dave F > > Thank you Dave! I'm emerging dev-tcltk/expect as I type > this. Hopefully the > learning curve won't be too steep. ;-) You may also wanna try the ServerAliveInterval option in your client's ssh config. It sends some keepalive data to the server every X seconds, sounds like what you need.
Re: [gentoo-user] Keep alive within SSH session
On Sunday 17 Jul 2016 14:14:42 you wrote: > On Sun, 17 Jul 2016 17:35:55 +0100 > Mick wrote - > > > On Sunday 17 Jul 2016 16:20:30 Ralf wrote: > > > On 07/17/2016 04:02 PM, Mick wrote: > > > > I am not sure of the correct approach to achieve a prolonged remote= > > > > > > > > debugging session through SSH and avoid the SSH session timing out.= > > What you need is expect or Expect or pexpect depending on your base > scripting language preference - tcl, perl, or python. > > Dave F Thank you Dave! I'm emerging dev-tcltk/expect as I type this. Hopefully the learning curve won't be too steep. ;-) -- Regards, Mick signature.asc Description: This is a digitally signed message part.
Re: [gentoo-user] Keep alive within SSH session
On Sun, 17 Jul 2016 17:35:55 +0100 Mick wrote - > On Sunday 17 Jul 2016 16:20:30 Ralf wrote: > > On 07/17/2016 04:02 PM, Mick wrote: > > > I am not sure of the correct approach to achieve a prolonged remote= > > > > debugging session through SSH and avoid the SSH session timing out.= > What you need is expect or Expect or pexpect depending on your base scripting language preference - tcl, perl, or python. Dave F
Re: [gentoo-user] Keep alive within SSH session
On Sunday 17 Jul 2016 16:20:30 Ralf wrote: > On 07/17/2016 04:02 PM, Mick wrote: > > I am not sure of the correct approach to achieve a prolonged remote > > debugging session through SSH and avoid the SSH session timing out. > > > > This is what I try to achieve: > > > > I login into a router with SSH from my PC. Then I can run certain > > commands to start and monitor a debugging session in the router. > > However, if I leave alone the SSH session, it will soon time out. The > > debugging only runs while the session is live. Exiting the SSH session > > causes all debug output to be lost. > > Take a look at screen or tmux. man screen, man tmux. Thank you Ralph, but detaching the *local* terminal process of SSH does not in any way stop the login session on the router from timing out. > > If I continue to run (router) commands on the terminal, while the > > debugging is running, the SSH time out is postponed. > > you may also want to tweak some timeout options in your sshd_config The router login times out unless some command is fed into the login session a the time. So, I'll need to be able to run commands every so often on the router shell from within my SSH session (without sitting in front of my PC terminal of course). The commands 'watch', or 'at' might do it, but I am not sure if some script is necessary for this. -- Regards, Mick signature.asc Description: This is a digitally signed message part.
Re: [gentoo-user] Keep alive within SSH session
On 07/17/2016 04:02 PM, Mick wrote: > I am not sure of the correct approach to achieve a prolonged remote debugging > session through SSH and avoid the SSH session timing out. > > This is what I try to achieve: > > I login into a router with SSH from my PC. Then I can run certain commands > to > start and monitor a debugging session in the router. However, if I leave > alone the SSH session, it will soon time out. The debugging only runs while > the session is live. Exiting the SSH session causes all debug output to be > lost. Take a look at screen or tmux. man screen, man tmux. > > If I continue to run (router) commands on the terminal, while the debugging > is > running, the SSH time out is postponed. you may also want to tweak some timeout options in your sshd_config > > What do you suggest I try on an SSH terminal from my PC to keep running > recurring commands after I have connected to the router? I will need to keep > a debugging session going for some hours, in order to collect the data I'm > after. >
[gentoo-user] Keep alive within SSH session
I am not sure of the correct approach to achieve a prolonged remote debugging session through SSH and avoid the SSH session timing out. This is what I try to achieve: I login into a router with SSH from my PC. Then I can run certain commands to start and monitor a debugging session in the router. However, if I leave alone the SSH session, it will soon time out. The debugging only runs while the session is live. Exiting the SSH session causes all debug output to be lost. If I continue to run (router) commands on the terminal, while the debugging is running, the SSH time out is postponed. What do you suggest I try on an SSH terminal from my PC to keep running recurring commands after I have connected to the router? I will need to keep a debugging session going for some hours, in order to collect the data I'm after. -- Regards, Mick signature.asc Description: This is a digitally signed message part.