[ale] Scriptable motd for initial SSH login?
Michael H. Warfield
mhw at WittsEnd.com
Wed Sep 14 16:38:49 EDT 2011
On Wed, 2011-09-14 at 16:37 -0400, Michael H. Warfield wrote:
> On Wed, 2011-09-14 at 16:22 -0400, 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.)
> Right.
> But that's the case even if you had another motd.
Actually, thinking about it, you might even check to see of /dev/tty
exists for you (that would be your "console" to a ptty) and if so write
straight to it. If it doesn't, you might not want to do anything,
stdout or stderr, since you don't have a ptty allocated.
> > > 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
>
> Regards,
> Mike
Mike
--
Michael H. Warfield (AI4NB) | (770) 985-6132 | mhw at WittsEnd.com
/\/\|=mhw=|\/\/ | (678) 463-0932 | http://www.wittsend.com/mhw/
NIC whois: MHW9 | An optimist believes we live in the best of all
PGP Key: 0x674627FF | possible worlds. A pessimist is sure of it!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: This is a digitally signed message part
Url : http://mail.ale.org/pipermail/ale/attachments/20110914/fb9a653d/attachment.bin
More information about the Ale
mailing list