You can register and change the user name and password in the password file using the htpasswd command.
How to use the htpasswd command is described below:
(a) Format
htpasswd [-b][-c | -D] password-file-name user-name[password] |
(b) Parameters
- -b
Specify this parameter when you specify the password in the command line.
- -c
Specify this parameter when you create a new password file. You need not specify -c when you add a user and change the password in an already created password file.
- -D
Specify this parameter when you delete a user registration. If the specified user is registered in the specified password file, the utility deletes the corresponding user from the password file.
- password-file-name
Specify the password file that registers, changes, or deletes password.
- user-name
Specify the user name for which password is to be registered, changed, or deleted.
- password
Specify the password to be registered or changed. You can specify this parameter only when -b option is specified. .
(c) Usage method
If you specify the password file name, the user name to be registered, or the user name for which the password is to be changed, and run the htpasswd, the input of respective password is requested. If you enter the password twice, including the confirmation of password entry, the user name and the password of that user are registered in the password file:
C:\>"<Cosminexus-installation-directory>\httpsd\bin\htpasswd.exe" .passwd userxx ...1.
New password: ...2.
Re-type new password: ...3.
Updating password for userxxx ...4.
C:\> |
- Change the password of userxx
- Enter a new password
- Re-enter the new password
- End the registration of new password
When deleting the registration, start the htpasswd utility by specifying the -D option, the password file name, and the user name that is to be deleted.
C:\>"<Cosminexus-installation-directory>\httpsd\bin\htpasswd.exe" -D .passwd userxx ...1.
Deleting passwd for userxx ...2.
C:\> |
- Delete registration of userxx
- Delete the registration of userxx and exit
(d) Note
- On Windows, the maximum size of a password is 128 characters. The maximum size of the user name is 128 characters. On UNIX, the maximum size of the password is the maximum length returned by the system call the getpass() (a read password functionality) or 128 characters, whichever value is smaller. For details on the getpass(), see the OS manual.
- When the htpasswd command is executed, a temporary work file is created in the directory in which the password file is created. The work file name is password-file-name.process-ID. The work file is deleted when the htpasswd command ends. However, the work file might not be deleted if you cancel to end the htpasswd utility while it is running. Manually delete the work file if it is not deleted automatically.