With Christmas around the corner, I'd like to make my system's prompt (for every user) a bit more festive and cheery.
Namely, I'd like to attach a Happy Holidays!
(or similar) message post-login for every user on the system (on terminal login, SSH or locally). I'd assume this is a simple echo
command, but I'm not sure where the appropriate place to put this command is in such a way that it would affect everyone. For obvious reasons, I'd rather not modify everyone's .bashrc
. So, where is that?
Linux can do this using the
/etc/motd
system, or any system that extends that (namely,update-motd
).Given this information, it's possible to add a simple shell script to
/etc/update-motd.d/40-holiday
:Upon marking this as runnable (
sudo chmod a+x /etc/update-motd.d/40-holiday
), the MOTD can be forcefully updated using the commandupdate-motd
(as root).Any subsequent logins will use the new (expanded) MOTD, finally bringing some holiday cheer to anybody who has to log on to a server on Christmas day.
Note that this method depends on the
update-motd
package, which should be pre-installed. But if it's not,sudo apt install update-motd
.Try using \u1f384 and reference https://unix.stackexchange.com/questions/25903/awesome-symbols-and-characters-in-a-bash-prompt for common pitfalls.
I would suggest changing the motd banner, if I understand what you want correctly. I don't remember off the top of my head how it's done best in Ubuntu, but if you want to be lazy you could modify one of the files in /etc/update-motd.d/, such as
98-reboot-required
and throw anecho "Happy Holidays!";
at the end.If you are using SSH and
motd
, don't forget to updatesshd_config
.Change:
PrintMotd no
to:PrintMotd yes
And restart the ssh server to apply the changes.