[ale] Scriptable motd for initial SSH login?

David Tomaschik david at systemoverlord.com
Wed Sep 14 16:22:56 EDT 2011


On Wed, Sep 14, 2011 at 3:37 PM, James Sumners <james.sumners at gmail.com> wrote:
> Well, I had thought of that, but then I read [1] and it says:
>
> "SSHRC
>
>     If the file ~/.ssh/rc exists, sh(1) runs it after reading the environment
>     files but before starting the user's shell or command.  It must not pro-
>     duce any output on stdout; stderr must be used instead."
>
> This is explicitly counter to what I want to do so I didn't even
> bother trying it. But, since you guys have suggested it, I just tried
> adding the following to ~/.ssh/rc and logging in:
>
> #!/bin/bash
> echo -n "Does this work?\n"

Make sure you're outputting to stderr, not stdout.  The man page
wasn't kidding about that.  If you output to stdout, then programs
that use SSH as a transport will be broken because they'll see the
output of your script in their data stream.  (This includes rsync,
scp, etc.)

> Guess what? It worked. So, thank you for making me re-examine this option.
>
> [1] -- http://www.manpagez.com/man/8/sshd/
>



-- 
David Tomaschik, RHCE, LPIC-1
System Administrator/Open Source Advocate
OpenPGP: 0x5DEA789B
http://systemoverlord.com
david at systemoverlord.com



More information about the Ale mailing list