• Change background/foreground colors on login?

    From todd@toddblum.org@21:1/5 to All on Wed Mar 21 05:49:20 2018
    Hello,

    I have two different groups of Linux servers. When the users connect via SSH, I'd like to have different background/foreground color combinations, depending on what type of server that it is. The users are all connecting from Windows.

    Right now PuTTY is being called from another application that's aware of the type of server they are being connected to, and can set command line arguments to it.

    Is it better to set the PuTTY terminal colors with command line arguments to PuTTY, or is there a way to set the foreground/background colors in the login scripts on the Linux servers, or is there some other way?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard@21:1/5 to All on Wed Mar 21 16:22:58 2018
    [Please do not mail me a copy of your followup]

    todd@toddblum.org spake the secret code <80e2f43f-a456-4e89-9818-2f2d1af4296a@googlegroups.com> thusly:

    Is it better to set the PuTTY terminal colors with command line
    arguments to PuTTY, or is there a way to set the foreground/background
    colors in the login scripts on the Linux servers, or is there some other
    way?

    I have done something similar in the past and have done it with
    command-line arguments to my tools. This works well with different
    DOS prompts in Windows, for instance.

    However, you can also do it from the login scripts by emitting ESC
    sequences to set the fg/bg color. This depends on the terminal
    emulator used by the connecting software (PuTTY in this case)
    understanding the ESC sequences to affect the change. Most terminal
    emulators support ANSI ESC sequences, so you're looking for "Select
    Graphic Rendition" (SGR) ANSI sequence:

    ESC '[' # ';' # 'm'

    (Literal characters shown as '[' means the character [.)

    Consult this table for replacements for # to select colors: <http://bluesock.org/~willkg/dev/ansi.html#sequences>
    --
    "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
    The Terminals Wiki <http://terminals-wiki.org>
    The Computer Graphics Museum <http://computergraphicsmuseum.org>
    Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)