#!/bin/bash<br>
echo -n "Welcome to the Computer $USER"<br><br>Unless there is absolutely going to only ever be one user you want to so treat, I would write a script for it.<br><br><div class="gmail_quote">On Wed, Sep 14, 2011 at 3:37 PM, James Sumners <span dir="ltr"><<a href="mailto:james.sumners@gmail.com">james.sumners@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Well, I had thought of that, but then I read [1] and it says:<br>
<br>
"SSHRC<br>
<br>
If the file ~/.ssh/rc exists, sh(1) runs it after reading the environment<br>
files but before starting the user's shell or command. It must not pro-<br>
duce any output on stdout; stderr must be used instead."<br>
<br>
This is explicitly counter to what I want to do so I didn't even<br>
bother trying it. But, since you guys have suggested it, I just tried<br>
adding the following to ~/.ssh/rc and logging in:<br>
<br>
#!/bin/bash<br>
echo -n "Does this work?\n"<br>
<br>
Guess what? It worked. So, thank you for making me re-examine this option.<br>
<br>
[1] -- <a href="http://www.manpagez.com/man/8/sshd/" target="_blank">http://www.manpagez.com/man/8/sshd/</a><br>
<div><div></div><div class="h5"><br>
On Wed, Sep 14, 2011 at 15:02, Chris Fowler <<a href="mailto:cfowler@outpostsentinel.com">cfowler@outpostsentinel.com</a>> wrote:<br>
> On Wed, 2011-09-14 at 14:31 -0400, Michael H. Warfield wrote:<br>
><br>
>> Anything wrong with sticking it in their (or the default) sshrc file?<br>
>><br>
><br>
> I think that is an excellent solution.<br>
><br>
> --------------------------------------------------------------------------------<br>
> 5.6.4. Arbitrary Actions with /etc/sshrc<br>
> When a user logs in, the normal Unix login system typically runs some<br>
> shell scripts, such as /etc/profile. In addition, sshd runs the<br>
> script /etc/sshrc for each SSH-based login. This feature lets the system<br>
> administrator run special commands for SSH logins that don't occur for<br>
> ordinary logins. For example, you can do some additional logging of SSH<br>
> connections, print welcome messages for SSH users only, and set<br>
> SSH-related environment variables.<br>
><br>
> In all three, SSH1, SSH2, and OpenSSH, /etc/sshrc is processed by<br>
> theBourne shell ( /bin/sh) specifically, rather than the user's shell,<br>
> so that it can run reliably for all accounts regardless of their various<br>
> shells. It is run for logins (e.g., ssh my-host) and remote commands<br>
> (ssh my-host /bin/who), just before the user's shell or command is<br>
> invoked. It runs under the target account's uid, so it can't take<br>
> privileged actions. If the script exits due to an error (say, a syntax<br>
> error), the SSH session continues normally.<br>
><br>
> Note that this file is run as input to the Bourne shell: sshd<br>
> runs /bin/sh /etc/sshrc, not /bin/sh -c /etc/sshrc. This means that it<br>
> can't be an arbitrary program; it must be a file containing Bourne-shell<br>
> commands (and it doesn't need the execute mode bit set).<br>
><br>
> /etc/sshrc operates machinewide: it is run for every incoming SSH<br>
> connection. For more fine-grained control, each user may create the<br>
> script ~/.ssh/rc to be run instead of /etc/sshrc. [Section 8.4, "The<br>
> User rc File "] /etc/sshrc isn't executed if ~/.ssh/rc exists in the<br>
> target account. Note that SSH rc files interact with X authentication.<br>
> [Section 9.3.5.2, "xauth and the SSH rc files"]<br>
><br>
> --------------------------------------------------------------------------------<br>
><br>
> Create an /etc/sshrc and then create individual files<br>
> in /etc/user_motds/ Then use the UID's to display the individual files.<br>
> Something as simple as this:<br>
><br>
> #!/bin/sh<br>
><br>
> MOTD="/etc/user_motds/${UID}.txt<br>
><br>
> if [ -f $MOTD ]<br>
> then<br>
> cat $MOTD<br>
> fi<br>
<br>
<br>
<br>
</div></div><div class="im">--<br>
James Sumners<br>
<a href="http://james.roomfullofmirrors.com/" target="_blank">http://james.roomfullofmirrors.com/</a><br>
<br>
"All governments suffer a recurring problem: Power attracts<br>
pathological personalities. It is not that power corrupts but that it<br>
is magnetic to the corruptible. Such people have a tendency to become<br>
drunk on violence, a condition to which they are quickly addicted."<br>
<br>
Missionaria Protectiva, Text QIV (decto)<br>
CH:D 59<br>
<br>
</div><div><div></div><div class="h5">_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>This Apt Has Super Cow Powers - <a href="http://sourcefreedom.com">http://sourcefreedom.com</a><br>