3.2.1 htpasswd
The htpasswd command registers the user name and password in the password file, and changes the password.
Synopsis
htpasswd [-b] [-c|-D] password-file-name user-name [password]
Storage location
Application Server installation directory/httpsd/sbin
Function
Registers a user name and password in the password file. You can change the password or delete a user name registered in the password file.
Execution permission
Superuser
Arguments
- -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.
Examples
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:
$ "Application Server installation directory/httpsd/sbin/htpasswd" .passwd userxx ...1. New password: ...2. Re-type new password: ...3. Adding password for user userxx ...4. $
-
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.
$ "Application Server installation directory/httpsd/sbin/htpasswd" -D .passwd userxx ...1. Deleting password for user userxx ...2. $
-
Delete registration of userxx
-
Delete the registration of userxx and exit
Exit Status
Exit Status |
Explanation |
---|---|
0 |
command executed successfully. |
Other than 0 |
error in executing the command. |
Notes
-
The maximum length of a user name and password is 128 characters.
-
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.