50

I want to change the password I assigned to root on my Debian webserver to something longer and more secure.

How do I do that? I haven’t forgotten/lost the current password, I just want to change it.

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232

3 Answers3

82

Ah, use the passwd program as root:

sudo passwd root

Or, if you’re running as root already (which you shouldn’t be), just:

passwd

The root argument can be omitted, because when you execute passwd it defaults to the current user (which is root, as only root can change the root password).

5

If you're going to be doing a lot of command-line administration, you might find it useful to check out the man pages for usermod(8), chfn(1), chsh(1), passwd(1), crypt(3), gpasswd(8), groupadd(8),

-2

You have to boot in Recovery Mode before using Paul D. Waite's suggestion:

  1. Right after booting your Debian system choose "boot in Recovery Mode"
  2. Right after booting into "Recovery Mode" right at the command prompt simply type:

    sudo password root
    

    then the system will ask for the new Root's password once and twice to verify and you ARE done.

Anthon
  • 79,293
  • 1
    “You have to boot in Recovery Mode before using Paul D. Waite's suggestion” — Really? I don’t remember doing that. Is this a new thing in a new version of Debian? – Paul D. Waite Sep 17 '14 at 15:56