Have you ssh’d into a production server and had no idea what to do next? For example, I ssh’d into a production Rails server but didn’t know how to access Rails console. It wasn’t straight forward. I was met with a black screen and a white cursor.
When you ssh into a server, a motd (message of the day) comes up. It’s typically showing server stats. You can modify it to show a descriptive welcome message.
On Ubuntu either find or create a motd file in /etc
. Let’s open and add something to it with nano.
cd /etc
touch motd
nano motd
Save the file, close the terminal and ssh into the server again. You’ll see the motd on screen. In my case:
# /etc/motd
Welcome to Production Server 1/3.
==Shortcuts==
Rails Console: rails_console
Project Folder: rails_folder
That’s a much better motd message and the user is no longer lost.
Want to make it really spiffy? Add a title from the ASCII Art Generator. Now you’re a real hax0r.
___ _ ___
| \ ___ __ | |__ ___ _ _ / __| ___ _ _ __ __ ___ _ _
| |) |/ _ \/ _|| / // -_)| '_| \__ \/ -_)| '_|\ V // -_)| '_|
|___/ \___/\__||_\_\\___||_| |___/\___||_| \_/ \___||_|
Welcome to Production Server 1/3.
==Shortcuts==
Rails Console: rails_console
Project Folder: rails_folder
I use motd locally on my machine to remember alias shortcuts I’ve made. If you’re using zsh on MacOS, the motd file needs to be created in /etc/motd
.
Here’s a glimpse of what a piece of it looks like on my machine.
-----------------------------------------
| Change Message | sudo nano /etc/motd |
| Change Aliases | nano ~/.zshrc |
-----------------------------------------
| ssh dokku vps | ssh_docker |
| kill rails s | kill_rails_server |