Linux useradd not creating password

05 July,2010 by Jack Vamvas

I've found that executing similar code to the below was not creating the password.As a consequence I needed to run the passwd process separately.


$useradd -g db2fadm1 -m db2fenc1 -p mypassword -d /db2inst1/db2fenc1


The -p parameter is designed to pass encrytpted passwords.

The following method creates an encrypted password , which can be added to the -p switch.

To assign an initial password, use the following steps:
Start the command line Python interpreter with the python command.


$python


displays the following:

Python 2.4.3 (#1, Sep 17 2008, 16:07:08) [GCC 4.1.2 20071124 (Red Hat 4.1.2-41)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>>

At the prompt, type the following commands. Replace <mypassword> with the
password to encrypt and <salt> with a random combination of at least 2
of the following: any alphanumeric character, the slash (/) character or
a dot (.):

import crypt;
crypt.crypt("<mypassword>","<salt>")

The output is the encrypted password, similar to '32DsGd8HRcKSM'.

To exit the Python interpreter use Ctrl-D

At the shell, enter similar to the following command , notice I've added the output from the Python script
to the -p switch

#code start
useradd -g db2fadm1 -m db2fenc1 -p '32DsGd8HRcKSM' -d /db2inst1/db2fenc1
#code end


You can then test the result , by commiting a test logon

The benefit of this method allows the DBA to store installation files without having to expose passwords

 Ref:Jack Vamvas(http://www.dba-db2.com)

 

Author: Jack Vamvas(http://www.dba-db2.com)

Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on Linux useradd not creating password

Comments are moderated, and will not appear until the author has approved them.


dba-db2.com | DB2 Performance Tuning | DBA DB2:Everything | FAQ | Contact | Copyright