[ale] Scriptable motd for initial SSH login?

Geoffrey Myers lists at serioustechnology.com
Thu Sep 15 07:35:31 EDT 2011


David Tomaschik wrote:
> 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.)

exec >&2

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


-- 
Until later, Geoffrey

"I predict future happiness for America if they can prevent
the government from wasting the labors of the people under
the pretense of taking care of them."
- Thomas Jefferson


More information about the Ale mailing list