How to change the Pi username and password on our Raspberry Pi

Raspberry Pi 3

Many times we have talked about creating projects with our Raspberry Pi open to the public. Even many users do is connect several Raspberry Pi boards to have a small but powerful server as a result. The problem that many users have is that the Pi user remains and therefore their projects are vulnerable since knowing the administrator user, it is easy to know the password.
For this reason we are going to tell you how to change Pi user and password, making our Raspberry Pi board and our projects safer than ever and we can use it without any problem and open to the public.

Change Password

I know the important thing is to change the Pi user, but first of all, let's try easy things. So first we are going to change the password. There are two options, one of them is to use the Rasp-config script, a process that is long and complicated. The second option is to use the terminal and type the following:

passwd

This command it will ask you for the new password and repeat the new password, to ensure that we have entered the new password correctly.

This last method is simple and quick to do.

How to make a robot
Related article:
How to make a robot: 3 different options

Change user Pi

Now comes the most important change. In this case we have to use the terminal. First we have to enable the root user which is disabled by default and then, from the root user, change the Pi user. So, in the terminal we write the following:

sudo passwd root

This will not only enable the root user but will change the root password. Once we have changed it, we enter as root and type the following:

usermod -l NUEVO_USUARIO pi -md /home/NUEVO_USUARIO

Where we have put "new user" we have to put the new user that we want to put. Then we have to change the password or keep it, in any case, the password will be the same as the root user. Something that should be known and that is important. Now, we have to change the group to user Pi, a user who is still on the machine. To do this we write the following in the terminal:

groupmod -n <nombre nuevo del grupo>  pi

The new group, if possible, that is not one in which our user is. Once this is done, we are going to disable the root user (remove the password), so that only our user remains as unique. To do this we write in the terminal:

sudo passwd –l root

Personally, I recommend you change the password as well, thus creating a new user with a new password as well and of course doing the latter. A) Yes the security of our device will be the highest possible and it will be difficult for strangers to enter our projects.


A comment, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Miky said

    And how can I make it so that it doesn't ask for a password and boot directly? I use the raspberry in an arcade with a back foot and I wish I didn't have to type around every time I turn it on, since I don't need any security.