zsh-users
 help / color / mirror / code / Atom feed
From: Kurtis Rader <krader@skepticism.us>
To: TJ Luoma <luomat@gmail.com>
Cc: Zsh-Users List <zsh-users@zsh.org>
Subject: Re: how can I invoke zsh via screen when logged in via ssh?
Date: Thu, 23 Jan 2014 22:12:29 -0800	[thread overview]
Message-ID: <CABx2=D8VaRNruqVc7ZyY9RczkeQfe-pNP-MLWhz2k8qE=4_x=w@mail.gmail.com> (raw)
In-Reply-To: <CADjGqHsv+YdBYp7Q7Enp0kcmTWk_45AYKvzraFWyB4Y5YLdg0A@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2960 bytes --]

I strongly recommend using tmux rather than screen. It has a much saner
configuration language and is more powerful. It also correctly handles
terminals which support 256 colors. I wrote a pair of scripts for work that
wraps around ssh and tmux (and iTerm2 for Mac OS X). This allows me to type

    work attach

to create iTerm2 windows appropriately sized and positioned and attach each
to its corresponding tmux session on the remote host. If the tmux session
isn't already running one is created. It also takes care of ensuring the
DISPLAY environment variable is set appropriately to allow X11 based apps
to display on my local system.

It also supports a bunch of other commands, For example, "work list" to
enumerate existing tmux sessions. Or "work ssh" to get a raw ssh session.

If there's interest I can work on removing my employer specific bits (which
deal with managing a VPN tunnel).



On Wed, Jan 22, 2014 at 11:54 AM, TJ Luoma <luomat@gmail.com> wrote:

> I use zsh as my login shell for several accounts I connect to via ssh.
>
>
> My connection to these accounts is often fragile, either because they
> were initiated on an iOS device or behind a satellite internet
> connection.
>
>
> I had a thought today that perhaps one answer would be to use
> 'screen(1)' as my login shell for those accounts, but then I realized
> that I didn't want that to be the shell I use for local logins, just
> for SSH logins.
>
>
> I wondered if anyone had already done this, so I didn't have to
> re-invent the wheel, or might have some experience with potential
> problems that I might run into when doing this.
>
>
> 1) Would 'zsh' function normally when in screen(1) ?
>
>
> 2) I've already noticed that emacs keys don't seem to work right, i.e.
> control+a does not jump to the beginning of the line, although
> control+e jumps to the end of the line. Should I make some adjustment
> to `bindkeys` or anything else?
>
>
> 3) What's the 'best' way to invoke screen(1) from .zshenv ? I already have
> this:
>
>
> PPID_NAME=$(command ps -o 'command=' -cp ${PPID} 2>/dev/null )
>
>
> case "${PPID_NAME}" in
>
>         sshd)
>
>                         SSH=yes
>
>         ;;
>
>
>         launchd)
>
>                         LAUNCHD=yes
>
>         ;;
>
>
> esac
>
>
> So I was going to change it to:
>
>
>
> PPID_NAME=$(command ps -o 'command=' -cp ${PPID} 2>/dev/null )
>
>
> case "${PPID_NAME}" in
>
>         sshd)
>
> exec =screen -r || exec =screen
>
>         ;;
>
>
>         launchd)
>
>                         LAUNCHD=yes
>
>         ;;
>
>
> esac
>
>
> which would, I believe, resume an existing `screen` session if one
> existed, but would otherwise just launch `screen` anew.
>
>
> Is there a better way?
>
>
> Thanks in advance,
>
>
> TjL
>
>
>
>
> ps - bonus question: anyone know how to tell screen(1) to _not_ show
> its welcome message every time it launches?
>



-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

  parent reply	other threads:[~2014-01-24  6:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-22 19:54 TJ Luoma
2014-01-22 21:22 ` Simon Ruderich
2014-01-22 23:48   ` TJ Luoma
2014-01-23  6:49   ` Dirk Heinrichs
2014-01-23  6:20 ` nyuszika7h
2014-01-24  6:12 ` Kurtis Rader [this message]
2014-01-24 12:40 ` Richard Hartmann
2014-01-24 16:23   ` Axel Beckert
2014-01-24 19:50   ` Christoph (Stucki) von Stuckrad
2014-01-24 14:20 ` lilydjwg
2014-01-25 17:51 ` Thorsten Kampe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABx2=D8VaRNruqVc7ZyY9RczkeQfe-pNP-MLWhz2k8qE=4_x=w@mail.gmail.com' \
    --to=krader@skepticism.us \
    --cc=luomat@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).