4

I was trying to use sudo to change the default account name, but it didn't work. So, I added a password to the root account and logged in as root. By default, you can't login to root through the login screen, adding a password to it allowed this.

It worked, but I have found another problem; I can't figure out how to remove the password again. Several guides online say you can do it, but don't say how.

  • I'm sure this question or a variant of it has been asked here before... – Darth Vader Apr 29 '17 at 12:32
3

Disable remote login

Run sudo nano /etc/ssh/sshd_config

and set PermitRootLogin yes to 'no'.

Reboot or restart the ssh service with /etc/init.d/ssh restart

Disable root completely

To completely disable root-access, either lock it via passwd --lock root or remove the password by executing passwd -d root

| improve this answer | |
  • 1
    This only prevents logins via SSH not directly from the keyboard. – Steve Robillard Apr 29 '17 at 19:37
  • Don't know about older versions but I just found out that Raspbian 9 has pam_unix.so nullok_secure by default, so passwd -d [user] will allow login without a password. passwd -l [user] must be used instead. – AndrolGenhald Feb 20 '18 at 4:08
2

I just found out that sudo passwd -l root does exactly what I wanted.

| improve this answer | |
  • passwd -l is short for passwd --lock :D – mystery May 1 '17 at 13:36
  • I used your command to disable root login into the GUI, but I still get prompted for a login, only now root does not work any more and the standard user "pi" is also not logging in - albeit not stating an error, simply showing a login promt again. – Ben Jul 11 '18 at 10:57
  • Did you actually use passwd -l with no username/account ? REMEMBER: never use code from the internet without understanding what it does. – Phill Healey Apr 13 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.