On Mon, 4 Aug 2008, Woodchuck wrote:
> On Mon, 4 Aug 2008, Tony Berth wrote:
>
> > Hi,
> >
> > is any way to display a pre-defined message for a specific user or a group
> > of users any time they log into their account?
> >
> > Thanks
> >
> > Tony
>
> Just to get the ball rolling, man login.conf, and look at capability
> "welcome", which defaults to /etc/motd. I think you can set this
> capability for various users... how, I'm not too sure, since I don't
> mess with login.conf more than once every five years or so.
>
> Dave
Now that I look at the /etc/login.conf file, I see there's an example
already present in which members of the class "authpf" get a customized
motd.
Unfortunately, I can see nothing other than the login class available
to discriminate among users or groups. So this is not as fine grained
as you want.
If the users are "disciplined", it would be easy enough to write a
hack into /etc/profile (or the equivalent for other shells) to cat
a file based on the user's UID and/or group memberships. By
"disciplined" I mean the users wouldn't try to weasel out of executing
/etc/profile by some sly means -- i.e. they should want to see these
messages.
Don't put this in /etc/ksh.kshrc or equivalent places for other
shells; you do not want this custom motd spewing out except for a
login shell. I recall a fun afternoon tracing down a bizarre bug
in "make build" due to a stray carriage return being emitted by
ksh.kshrc.
The hack would take the form of a big "case" statement, based on
UID and maybe GID. A little auxiliary program in perl or C might
be more fun to do.
A slicker way would be to hack the source to login, but that's a
wee bit delicate and "unsupported". It's a swell way to lock up
a system tighter than a crab's butt, not ~quite~ as bad as wrecking
/bin/sh, but you get the picture.
I'm kinda surprised that this capability that you describe doesn't
exist already. I would think that one should be able to run arbitrary
code based on UID and GID and even terminal line and time of day
during login. Am I missing something?
Dave
--
When was the day your shine was taken?
-- gerg
_______________________________________________
Openbsd-newbies mailing list
[email protected]
http://mailman.theapt.org/listinfo/openbsd-newbies