I was looking around for some info on how to change up the welcome message I see when I ssh into my raspberry pi and I ended up going down a lot of winding paths. The info was all spread out in bits and pieces. Here’s what I did.
First you open up your terminal. On a mac you open “Applications” then go to “Utilities” then click on “Terminal”. I have iTerm2 installed. It’s a replacement terminal which is highly customizable.
After you get the terminal window open you’ll need to open the file which is used to load up the welcome message. To do that type:
sudo vim /etc/motd
You’ll end up with something like this,
But wait, this is just a blank thing. Quite honestly, the first time I typed “vim” or “vi” I didn’t know what to do. I was stuck and I had no idea what I was doing. Eventually I found and worked my way through this Interactive Vim Tutorial a few times before I started getting the hang of it.
Here’s the important stuff to know:
When you load up a file by typing
sudo vim filename you’re just opening up the file to view it. Also, putting ‘sudo’ in front means you’re editing the file as the root user. For some files you don’t need to be root, but for this particular one you do.
Some important vim concepts:
- When you first open the file it will be in command mode. While in command mode you will not be able to edit the text by just typing.
- There are lots of shortcuts to learn for command mode, but I’m not going to get into them now. Here’s a pretty good list of vim commands
- To start editing the file hit the ‘i’ key. Then type all the stuff you want. Paste in your ascii or do whatever else. Links below to some ascii art generators.
- To switch back to command mode hit the ‘esc’ key.
- When you’re done editing and you want to go back to the terminal and leave vim or vi make sure you’re in command mode by hitting ‘esc’ and then type “:”.
- The basic things to type here are
- :wq! - (w)rite your changes and (q)uit immediately(!)
- :q! - (q)uit and don’t save changes(!)
- :q - (q)uit and don’t let me out if I made changes. Then do one of the two above to get out.
Here’s a few different sites I found to generate different kinds of ascii art:
Ok, now all you have to do is ssh into your rasbperry pi. Easy, except that you might not know where your rasbperry pi is on your network. And you might not know how to find out the ip address.
To find the ip address when you’re on the raspberry pi itself you can type
ifconfig -a and then look for
inet addr:192.168.x.x. The ‘x.x’ part is going to be specific to your network.
If you’re on a mac and you want to know what other devices are on your network then type
arp -a. If you have multiple devices on your network you might have to do some guessing about which is your pi.
You also need to know the username you’d like to log into on your rasberry pi. If you installed raspbian then by default the user name is ‘pi’ and the password is ‘raspberry’. Once you find the ip address and you know what your username and password should be type:
If you’ve set everything up correctly the next time you connect to your rasbperry pi you’ll have a fun new message waiting for you when you enter.
Finally, if you do ssh into your rpi then to get out just type ‘logout’.