<div dir="ltr">On Mon, Aug 4, 2008 at 9:32 PM, Woodchuck <span dir="ltr">&lt;<a href="mailto:marmot@pennswoods.net">marmot@pennswoods.net</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Mon, 4 Aug 2008, Woodchuck wrote:<br>
<br>
&gt; On Mon, 4 Aug 2008, Tony Berth wrote:<br>
&gt;<br>
&gt; &gt; Hi,<br>
&gt; &gt;<br>
&gt; &gt; is any way to display a pre-defined message for a specific user or a group<br>
&gt; &gt; of users any time they log into their account?<br>
&gt; &gt;<br>
&gt; &gt; Thanks<br>
&gt; &gt;<br>
&gt; &gt; Tony<br>
&gt;<br>
&gt; Just to get the ball rolling, man login.conf, and look at capability<br>
&gt; &quot;welcome&quot;, which defaults to /etc/motd. &nbsp;I think you can set this<br>
&gt; capability for various users... how, I&#39;m not too sure, since I don&#39;t<br>
&gt; mess with login.conf more than once every five years or so.<br>
&gt;<br>
&gt; Dave<br>
<br>
</div>Now that I look at the /etc/login.conf file, I see there&#39;s an example<br>
already present in which members of the class &quot;authpf&quot; get a customized<br>
motd.<br>
<br>
Unfortunately, I can see nothing other than the login class available<br>
to discriminate among users or groups. &nbsp; So this is not as fine grained<br>
as you want.<br>
<br>
If the users are &quot;disciplined&quot;, it would be easy enough to write a<br>
hack into /etc/profile (or the equivalent for other shells) to cat<br>
a file based on the user&#39;s UID and/or group memberships. &nbsp;By<br>
&quot;disciplined&quot; I mean the users wouldn&#39;t try to weasel out of executing<br>
/etc/profile by some sly means -- i.e. they should want to see these<br>
messages.<br>
<br>
Don&#39;t put this in /etc/ksh.kshrc or equivalent places for other<br>
shells; you do not want this custom motd spewing out except for a<br>
login shell. &nbsp;I recall a fun afternoon tracing down a bizarre bug<br>
in &quot;make build&quot; due to a stray carriage return being emitted by<br>
ksh.kshrc.<br>
<br>
The hack would take the form of a big &quot;case&quot; statement, based on<br>
UID and maybe GID. &nbsp;A little auxiliary program in perl or C might<br>
be more fun to do.<br>
<br>
A slicker way would be to hack the source to login, but that&#39;s a<br>
wee bit delicate and &quot;unsupported&quot;. &nbsp;It&#39;s a swell way to lock up<br>
a system tighter than a crab&#39;s butt, not ~quite~ as bad as wrecking<br>
/bin/sh, but you get the picture.<br>
<br>
I&#39;m kinda surprised that this capability that you describe doesn&#39;t<br>
exist already. &nbsp;I would think that one should be able to run arbitrary<br>
code based on UID and GID and even terminal line and time of day<br>
during login. &nbsp;Am I missing something?<br>
<div class="Ih2E3d"><br>
Dave<br>
--<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;When was the day your shine was taken?<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -- gerg<br>
</div>_______________________________________________<br>
Openbsd-newbies mailing list<br>
<a href="mailto:Openbsd-newbies@sfobug.org">Openbsd-newbies@sfobug.org</a><br>
<a href="http://mailman.theapt.org/listinfo/openbsd-newbies" target="_blank">http://mailman.theapt.org/listinfo/openbsd-newbies</a><br>
</blockquote></div><br><br>Sorry for my late reply and thanks for your valuable Info. Actually the login class mechanism is fine for my needs.<br><br>Just a last question, in login.conf, when I define a new class, can I inherit/include settings from an existing class and just add my own modifications?<br>
<br>Thanks<br><br>Tony<br></div>