Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I want to show for each user that login through ssh an specific message, like a todo list for that specific user, I know that I can user /etc/motd or /etc/issue to display a message system wide but I don't know how to do the same only for an specific user...
can anyone help me on that?
In alternative to what suggested by tredegar (which is an excellent advice, anyway) you can create a directory under /etc containing custom welcome messages for each users and put the username in the name of each file. For example:
# ls /etc/welcome
welcome_colucix welcome_maginotjr welcome_tredegar
then in /etc/bashrc (or equivalent) add the following line at the end
test $TERM == xterm && cat /etc/welcome/welcome_$USER
in this way you can mantain your list of MOTD without writing in each user's home directory every time you have to change them.
One last point, make sure you put in some kind of check to see if the file exists before attempting to display it or your users will see errors (colucix did this with test, just make sure you include a similar mechanism.)
At the end of each user's ~/.bashrc file you could put cat ~/todolist
Putting this in a user's ~/.bashrc file will the output on every new instance of bash (including sudo bash) rather than just on connect. Using ~/.profile instead is a better option, if this is a desired approach (e.g. someone wants a nice msg when connection to a system on which they have no admin access).