How do I tap into an SSH session?

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
gpioneer
Posts: 6
Joined: Sun Dec 24, 2017 10:27 am

How do I tap into an SSH session?

Post by gpioneer » Wed Feb 07, 2018 1:29 am

Let's say I start an SSH session on my laptop and have things going but have to restart my laptop for some reason, how can I access that session on the DietPi itself?

Like right now I have an install going over SSH on my laptop but want to pick it up on the Dietpi.


User avatar
MichaIng
Legend
Posts: 205
Joined: Sat Nov 18, 2017 5:21 pm

Re: How do I tap into an SSH session?

Post by MichaIng » Fri Feb 09, 2018 12:11 am

Exactly, how can I give thumbs on this forum? :D

Screen is absolutely great, must-have from my side. If there wasn't so much other topics on DietPi dev, I would have added it already, from my side as default. So it's on my minds list at least.

You can start some long task there, and if your SSH connection breaks or you want to drink coffee, the task will go on and you can reattach at any time.

Only downside was, that you can't scroll up the terminal output by default with mouse wheel. But I found a solution for this:

Code: Select all

cat << _EOF_ > ~/.screenrc
# Make screen windows scrollable
termcapinfo xterm|xterms|xs|rxvt ti@:te@
# Add information status line to screen windows
caption always "%{Gk}DietPi Screen | $LOGNAME@%H | %LD %d.%m.%Y %c | Load: %l | %-Lw%{kG}%n%f*%50> %t%{-}%+Lw%<"
_EOF_
The last line adds some kind of status line. Needs visual tuning, but the ugly code part on the right side actually lists all active screen windows and highlights the one you are attached. So if you want to have e.g. some files open in parallel or parallel running jobs, it helps a bid to keep overview.

User avatar
WarHawk
Posts: 254
Joined: Thu Jul 20, 2017 7:55 am

Re: How do I tap into an SSH session?

Post by WarHawk » Fri Feb 09, 2018 4:17 am

MichaIng wrote:Exactly, how can I give thumbs on this forum? :D.
Trust me..you would have gotten ALOT by now :D

User avatar
Fourdee
Site Admin
Posts: 2744
Joined: Tue Feb 06, 2007 12:36 pm

Re: How do I tap into an SSH session?

Post by Fourdee » Fri Feb 09, 2018 3:59 pm

WarHawk wrote:
MichaIng wrote:Exactly, how can I give thumbs on this forum? :D.
Trust me..you would have gotten ALOT by now :D
Agree, @MichaIng valuable, continued code contributions and end user support, does not go unnoticed.

Well deserved, mega thumbs up :D

Code: Select all

            _
           /(|
          (  :
         __\  \  _____
       (____)  `|
      (____)|   |
       (____).__|
        (___)__.|_____
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal and Bitcoin.

User avatar
k-plan
Posts: 403
Joined: Sun Feb 28, 2016 4:28 pm

Re: How do I tap into an SSH session?

Post by k-plan » Tue Feb 20, 2018 3:03 pm

MichaIng wrote: If there wasn't so much other topics on DietPi dev, I would have added it already, from my side as default. So it's on my minds list at least.

Code: Select all

            _
           /(|
          (  :
         __\  \  _____
       (____)  `|
      (____)|   |
       (____).__|
        (___)__.|_____
Fourdee wrote: @MichaIng valuable, continued code contributions and end user support, does not go unnoticed.
Agree as well.

Code: Select all

            _
           /(|
          (  :
         __\  \  _____
       (____)  `|
      (____)|   |
       (____).__|
        (___)__.|_____
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal and Bitcoin.

Narfel
Posts: 11
Joined: Wed Jan 31, 2018 9:19 am

Re: How do I tap into an SSH session?

Post by Narfel » Tue Feb 20, 2018 9:07 pm

dunno about screen but i use:

nohup some_command > output.log &
then i can close the session
to check if the process is still running: jobs -l
or to check status: tail -f output.log

Post Reply