It’s often very useful to add customized message (with info or specific commands) on a VM. The easiest way to do that is to use the /etc/motd
file. But what to do if you want to add a message just for one user ?
The first thing that everybody try is to add the message to the .bashrc
.
That’s a bad habit:
zapan:~$ ssh me@zapan 'uptime'
You shouldn't see this message !
17:16:45 up 4 days, 7:29, 4 users, load average: 1.81, 1.25, 0.83
As you can see the content is displayed in case of a non-interactive non-login shell invoked via ssh. Instead add your message to the .bash_profile
or .profile
file.
Further Reading and sources