I guess you are in AIX, and want this to work whichever way your NEW users connect (telnet,
ssh, rsh) and whatever shell they use (bash, ksh, csh). Here are two proposals,
none of them having any impact on existing users.
- First one based on accounting. But if you empty the accounting files, then all users will receive
your message the first time they connect afterwards.
Insert something like this in /etc/profile (here ksh/bash syntax)
if (( $(last -2 $LOGNAME | grep -c "^$LOGNAME") == 1))
then banner Welcome $LOGNAME
fi
- Second one, a bit longer but should always work
Edit /usr/lib/security/mkuser.sys and add some lines to add a __NEWUSER__ file,
chown and chgrp it (it's quite copy and paste of <hat's written for .profile or .login).
Then modify the $HOME/.profile (or $HOME/.login if csh) to test the __NEWUSER__ file,
print your message and then remove the file
if [[ -e $HOME/__NEWUSER__ ]]
then banner Hello $LOGNAME ; rm -f $HOME/__NEWUSER__ 2>/dev/null
fi