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
Leave a Reply