LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Printing custom motd (https://www.linuxquestions.org/questions/debian-26/printing-custom-motd-523072/)

dellthinker 01-26-2007 01:43 PM

Printing custom motd
 
How would i setup my machine to print a welcome msg for individual users? Sort of like
user1 - Hello How Are You Today/
user2 - Hiya user2! How are things?

Is there a way to customize debian like this? Thanx in advance.

MOS JEFF-INITELY 01-26-2007 02:13 PM

add to your /HOME/username/.profile which is lauched everytime the login process is started.

basileus 01-27-2007 03:14 AM

Or if you want to keep the _messages_ in one central place, say, /etc/mymotd, you could add the /home/user/.profile like this:

/etc/mymotd

and the create /etc/mymotd

MYUSER=$(whoami)

if [ $MYUSER == "joe" ]; then
echo "Message for Joe"
elif [ $MYUSER == "john" ];
echo "Message for John"
else
echo "Message for everybody else, if any"
fi

Then chmod 755 /etc/mymotd. NOTE: I did not test this but it should not have any typos in it :)

PB0711 02-05-2007 02:41 PM

Umm Can I jump in on this and ask what if it's NIS. Then if the person logs into another computer you won't be able to use that motd. I'm not the top sys admin so I would have to log into each user throught "su" -> "su user" and change the .bash_profiles, right?

MOS JEFF-INITELY 02-05-2007 03:34 PM

yea an NIS would be a problem with this method since they all have different profile files (.login, .cshrc, .profile, tcshrc, .kshrc or bashrc., ... [ although I think .profile works across the most shells]), I'm not sure how you could get around this without adding the message to each file .. this could be more than annoying and fairly time consuming.

as for changing the profiles themselves, yea if you dont have root you will need to either switch user or change the write permissions.

If any one has a way around the NIS I would like to know myself.

Thanks.


All times are GMT -5. The time now is 04:59 AM.