<div dir="ltr">On Mon, Aug 4, 2008 at 9:32 PM, Woodchuck <span dir="ltr"><<a href="mailto:marmot@pennswoods.net">marmot@pennswoods.net</a>></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>
> On Mon, 4 Aug 2008, Tony Berth wrote:<br>
><br>
> > Hi,<br>
> ><br>
> > is any way to display a pre-defined message for a specific user or a group<br>
> > of users any time they log into their account?<br>
> ><br>
> > Thanks<br>
> ><br>
> > Tony<br>
><br>
> Just to get the ball rolling, man login.conf, and look at capability<br>
> "welcome", which defaults to /etc/motd. I think you can set this<br>
> capability for various users... how, I'm not too sure, since I don't<br>
> mess with login.conf more than once every five years or so.<br>
><br>
> Dave<br>
<br>
</div>Now that I look at the /etc/login.conf file, I see there's an example<br>
already present in which members of the class "authpf" 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. So this is not as fine grained<br>
as you want.<br>
<br>
If the users are "disciplined", 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's UID and/or group memberships. By<br>
"disciplined" I mean the users wouldn'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'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. I recall a fun afternoon tracing down a bizarre bug<br>
in "make build" due to a stray carriage return being emitted by<br>
ksh.kshrc.<br>
<br>
The hack would take the form of a big "case" statement, based on<br>
UID and maybe GID. 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's a<br>
wee bit delicate and "unsupported". It's a swell way to lock up<br>
a system tighter than a crab's butt, not ~quite~ as bad as wrecking<br>
/bin/sh, but you get the picture.<br>
<br>
I'm kinda surprised that this capability that you describe doesn't<br>
exist already. 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. Am I missing something?<br>
<div class="Ih2E3d"><br>
Dave<br>
--<br>
When was the day your shine was taken?<br>
-- 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>