Optional Security - Disable root login
Posted: Tue May 05, 2015 9:12 am
Hi;
I love DietPi, it is the long lost server for my multiple Pi systems running all around my house and work.
I believe that there are some security issues which should be considered on the next release of DietPi, like starting with a normal user instead of using root for ssh access.
If you would like to secure your system please follow these steps;
After applying all of the above, you should have a pi user available in /home/pi with your desired password. Try becoming "pi" user by typing
and then try becoming root by typing
It should ask for your password to become the super user (root). If you are not able to become root, very carefully type exit to go back to your root session from pi session and go over the previous steps since you are probably missing something. If everything is OK, now try to connect to your pi with the new user you have created;
Now let's disable root password login, in /etc/default/dropbear change;
to
which would disable root password logins.
After this point you or someone else will not be able to login remotely with your root password. You will always have to login with your pi user (I'm sure you know that you can change that username if you want) and then become root which is a great way to secure a server setup from ssh brute force attacks.
I love DietPi, it is the long lost server for my multiple Pi systems running all around my house and work.
I believe that there are some security issues which should be considered on the next release of DietPi, like starting with a normal user instead of using root for ssh access.
If you would like to secure your system please follow these steps;
Code: Select all
groupadd -g 1000 pi
useradd -g 1000 -u 1000 -m -s /bin/bash -d /home/pi pi
apt-get install sudo
usermod -G sudo pi
passwd pi
Code: Select all
su pi
Code: Select all
sudo -s
Code: Select all
ssh pi@xxx.xxx.xxx.xxx
sudo -s
Code: Select all
DROPBEAR_EXTRA_ARGS=
Code: Select all
DROPBEAR_EXTRA_ARGS=-g
After this point you or someone else will not be able to login remotely with your root password. You will always have to login with your pi user (I'm sure you know that you can change that username if you want) and then become root which is a great way to secure a server setup from ssh brute force attacks.