Tag Archives: password

Puppet on Windows: set Administrator password to never expires

When maintaining windows server with puppet, it could be interesting to set your Administrator password to never expires.
Since you want to manage your passwords through puppet, and not manually by some hyper active sysadmin, this comes in handy.

Note the fact that it is wise to change passwords now and then 😉

On Windows you can only manage passwords through puppet… not any other expire settings.
You can read here that puppet on Windows does not support manages_password_age.

Therefor, after searching and testing a lot, I came with this class:

You’d think that instead of using WMIC USERACCOUNT, you can use a simple ‘net user administrator /expires:never, but that does not seem to be the case. Although your puppet agent reports that the setting has been modified, it did not… I only got it working with the WMIC command.

Also, when using | in the unless, you need to put the cmd.exe /c in your command. This is intended behaviour because of this:

Exec: Execute external binaries on Windows systems. As with the posix provider, this provider directly calls the command with the arguments given, without passing it through a shell or performing any interpolation. To use shell built-ins – that is, to emulate the shell provider on Windows — a command must explicitly invoke the shell

Forgot MySQL root password

I you forgot your MySQL root password, you can recover MySQL database server password with following five easy steps.

  • Stop the MySQL server process.
  • Start the MySQL (mysqld) server/daemon process with the --skip-grant-tables option so that it will not prompt for password.
  • Connect to mysql server as the root user.
  • Setup new mysql root account password i.e. reset mysql password.
  • Exit and restart the MySQL server.

Here are commands you need to type for each step (login as the root user):

  • Stop mysql service
  • Start to MySQL server without password:
  • Connect to mysql server using mysql client:
  • Setup new MySQL root user password
  • Stop MySQL Server:
  • Start MySQL server and test it