Use the asnpwd command to create and change password files on Linux, UNIX, and Windows. Run this command at the command line or in a shell script.
Command help appears if you enter the asnpwd command without any parameters, followed by a ?, or followed by incorrect parameters.
>>-asnpwd--+-init--| Init parameters |-----+------------------->< +-add--| Add parameters |-------+ +-modify--| Modify parameters |-+ +-delete--| Delete parameters |-+ '-list--| List parameters |-----' Init parameters |--+-----------------------+--+--------------------------+------| '-encrypt--+-all------+-' | .-asnpwd.aut----. | '-password-' '-using--+-filepath_name-+-' Add parameters |--alias--db_alias--id--userid--password--password--------------> >--+--------------------------+---------------------------------| | .-asnpwd.aut----. | '-using--+-filepath_name-+-' Modify parameters |--alias--db_alias--id--userid--password--password--------------> >--+--------------------------+---------------------------------| | .-asnpwd.aut----. | '-using--+-filepath_name-+-' Delete parameters |--alias--db_alias--+--------------------------+----------------| | .-asnpwd.aut----. | '-using--+-filepath_name-+-' List parameters |--+--------------------------+---------------------------------| | .-asnpwd.aut----. | '-using--+-filepath_name-+-'
Table 1 defines the invocation parameters for the asnpwd command.
Parameter | Definition |
---|---|
init | Specify to create an empty password file. This command will fail if you specify the init parameter with a password file that already exists. |
add | Specify to add an entry to the password file. There can only be one entry in the password file per db_alias. This command will fail if you specify the add parameter with an entry that already exists in the password file. Use the modify parameter to change an existing entry in the password file. |
modify | Specify to modify the password or user ID for an entry in the password file. |
delete | Specify to delete an entry from the password file. |
list | Specify to list the aliases and user ID entries in a password file. This parameter can be used only if the password file was created by using the encrypt password parameter. Passwords are never displayed by the list command. |
encrypt | Specifies which entries in a file to encrypt.
|
using filepath | Specifies the path and name of the password
file. Follow the file naming conventions of your operating system.
An example of a valid password file on Windows is C:\sqllib\mypwd.aut.
If you specify the path and name of the password file, the path and the password file must already exist. If you are using the init parameter and you specify the path and name of the password file, the path must already exist and the command will create the password file for you. If you do not specify this parameter, the default file name is asnpwd.aut and the default file path is the current directory. |
alias db_alias | Specifies the alias of the database to which the user ID has access. The alias is always folded to uppercase, regardless of how it is entered. |
id userid | Specifies the user ID that has access to the database. |
password password | Specifies the password for the specified user ID. This password is case sensitive and is encrypted in the password file. |
The asnpwd command returns a zero return code upon successful completion. A nonzero return code is returned if the command is unsuccessful.
The following examples illustrate how to use the asnpwd command.
Example 1
To create a password file with the default name of asnpwd.aut in the current directory:
asnpwd INIT
Example 2
To create a password file named pass1.aut in the c:\myfiles directory:
asnpwd INIT USING c:\myfiles\pass1.aut
Example 3
To create a password file named mypwd.aut with the encrypt all parameter:
asnpwd INIT ENCRYPT ALL USING mypwd.aut
Example 4
To create a password file named mypwd.aut with the encrypt password parameter:
asnpwd INIT ENCRYPT PASSWORD USING mypwd.aut
Example 5
To create a default password file with the encrypt password parameter:
asnpwd INIT ENCRYPT PASSWORD
Example 6
To add a user ID called oneuser and its password to the password file named pass1.aut in the c:\myfiles directory and to grant this user ID access to the db1 database:
asnpwd ADD ALIAS db1 ID oneuser PASSWORD mypwd using c:\myfiles\pass1.aut
Example 7
To modify the user ID or password of an entry in the password file named pass1.aut in the c:\myfiles directory:
asnpwd MODIFY AliaS sample ID chglocalid PASSWORD chgmajorpwd
USING c:\myfiles\pass1.aut
Example 8
To delete the database alias called sample from the password file named pass1.aut in the c:\myfiles directory:
asnpwd delete alias sample USING c:\myfiles\pass1.aut
Example 9
To see command help:
asnpwd
Example 10
To list the entries in a default password file:
asnpwd LIST
Example 11
asnpwd LIST USING pass1.aut
The output from this command depends on how the password file was initialized:
ASN1986E "Asnpwd" : "". The password file "pass1.aut" contains
encrypted information that cannot be listed.
asnpwd LIST USING pass1.aut
Alias: SAMPLE ID: chglocalid
Number of Entries: 1