There are a number of settings which people often change when they have just installed Linux.
If you are using your Banana Pi as a server, you may not need to use the Lightdm desktop environment, and just let your Banana Pi boot to a command line interface.
When Raspbian boots, it executes scripts in /etc/init.d to start various services, including Lightdm. You can use the update-rc.d command to prevent any of these scripts from running. This command stops Lightdm from running when you boot your Pi:
If you wish to start a desktop session from the command line, use this command:
If you want Lightdm to start on boot up again, use this command:
Many Linux images have a default username and password. The default username and password for the Raspbian image are 'pi' and 'bananapi' (in many of the Banana Pi Linux distributions, the default username is bananapi). It's best to change these login details so that no one else can log into your Pi.
You need to configure your Pi to boot to a command line - the following procedure won't work if you're logged into a desktop session. Once you've booted to a command line, you need to change the shell session to the root user. This is necessary because you can't modify a user account while you're logged in as that user.
Now all commands are executed as the root user. Change to a different directory than /home/pi:
Use the usermod command to change username of the default account
When you reboot, you'll need to log in using the new user name.
One of the most important things to change is the password. Using the default password is a monumental security risk. The default password for most Banana Pi Linux distributions is simply bananapi. Change it using the passwd command:
You will be prompted to enter your current password, followed by your new password twice.
The hostname is the name of your server as it appears on your local network. You may need to change the hostname if you have more than one Banana Pi on your network. You'll need to change it in two places:
The hostname is set in /etc/hostname. This file only contains the hostname. Open it as root, and change the name. I've change it from 'lemaker' to 'bpi'.
In /etc/hosts, there's a list of IP addresses and their host names. This file contains a table mapping IP addresses to host names. Open it with this command:
Look for an entry with IP address 127.0.1.1, and change the host name as required.
Reboot your Banana Pi, and you should see that its host name has changed.
If you're using a version of Linux installed from an image, the image may already contain keys. These keys are the same for anyone who's installed the same image, so it's important to change them.
There are keys that the ssh server daemon uses to authenticate incoming connections, which need to be removed:
Now create new keys:
A new set of ssh keys will be generated in /etc/ssh.
Users can generate ssh keys for themselves so that they can easily authenticate with ssh servers on other hosts. Using keys means users can be identified by their keys without needing to type a password.
Create a folder in my hom folder to store inthe keys:
Generate the keys:
You'll be prompted for a place to save the keys. Just press return to use the default location. This will create a pair of RSA key files in ~/.ssh/.
The public key must be transferred to any device I wish to log into with ssh. For example, if I wanto to log into another Linux host at IP address 192.168.0.3 as user dave, I would use this sequence of commands to transfer the public key:
It's necessary to type a password the first time the connection is made, but after that it's possible to connect to this device without typing a password.
Share this page: