blog'o thnet

To content | To menu | To search

Tag - password

Entries feed - Comments feed

Monday 25 July 2005

Alter the password of a user in Drupal, directly via the SGBD

Using Drupal as the CMS of choice for time now, there is a little thing assumed by the system at the first time the web site is launched which isn't welcomed in all situation: an already working mail environment.

In fact, when creating the first Drupal user (and so with administrative rights), the password is by default sent to the email address provided... even if there is no working email subsystem in order to take delivery of the random generated password. This can render the freshly installed CMS very... inefficient, don't you think?

So, in order to be able to log in, the password for this account may be directly reset to the SGBD (a MySQL data server in the following case). Here is how this can easily be achieved.

Obtain the checksum of the given string corresponding to the wanted password:

server# md5 -s padawan
MD5 ("padawan") = 9a4b83013501fde3e8864f4f4b5fb7c5

Update the password entry for the administrative account:

server# mysql -u dba_user -p drupal_database
Enter password: ********
mysql> UPDATE users SET pass = '9a4b83013501fde3e8864f4f4b5fb7c5'
    -> WHERE name = 'obiwan'\g\q
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0
Bye

That's all: just log in as usual via the Drupal web portal, using obiwan/padawan as login/password. And be prepared to build a working mail subsystem very soon for next time...

Saturday 25 June 2005

Password Management for Hosts in the Demilitarized Zone (DMZ)

Based on existing procedures, here is a new tool which aim is to help managing centralized passwords for all servers hosted in the demilitarized zone. As for the Static Route Management for Hosts in the Demilitarized Zone (DMZ), this script is managed using the cvs(1) concurrent management system.

Follow is the named script:

  • dmz_passwd.sh this one is able to get and set some password configurations and/or parameters remotely

Assuming that the environment variables ${CVSROOT} and ${CVS_RSH} are properly sets, here are little samples of usage:

# cvs checkout -P dmz_passwd && cd dmz_passwd
#
# sh ./dmz_passwd.sh
usage: dmz_passwd.sh [-hd] [-s servername,...] [-n min_day] [-x max_day] [-w warn_day] -u username,... {status|set|unlock|lock|reset}
#
# sh ./dmz_passwd.sh -s unic -u greg set
* server: unic
 => *set* password attributes and policy for user: greg
#
# sh ./dmz_passwd.sh -s unic,beastie -u greg status
* server: unic
 => *get* password attributes and policy for user: greg
    .password status: locked [LK]
    .last changed: 13 September 2004
    .minimum between password changes: 0 day(s)
    .maximum between password changes: 91 day(s)
    .warning before the password expires: 7 day(s)
    .password will expire at: 13 December 2004

* server: beastie
 => *get* password attributes and policy for user: greg
    .password status: passworded or locked [PS]

Need more help?... See the command line help switch:

# sh ./dmz_passwd.sh -h