手元の環境でhtpasswdのエントリを生成するのに、Docker使えばお手軽便利でした。
$ sudo docker run -it httpd:2.4.39-alpine htpasswd -nb otomo Passw0rd otomo:$apr1$MACrpovj$tMIF8X/QOnm740kB49CN5.
サーバーにhtpasswd入っている場合はもちろんそっち使った方が便利ですし、WEBサービスとかもあるので、そちらの方が早い場合もあります。
.htpasswd生成 | ベーシック認証用のパスワードを一発作成 | すぐに使える便利なWEBツール | Tech-Unlimited
色々オプション使えるところや、リダイレクトでコピペ無しで使えるところが、良いかなと思っています。
$ sudo docker run -it httpd:2.4.39-alpine htpasswd -h htpasswd: illegal option -- h Usage: htpasswd [-cimBdpsDv] [-C cost] passwordfile username htpasswd -b[cmBdpsDv] [-C cost] passwordfile username password htpasswd -n[imBdps] [-C cost] username htpasswd -nb[mBdps] [-C cost] username password -c Create a new file. -n Don't update file; display results on stdout. -b Use the password from the command line rather than prompting for it. -i Read password from stdin without verification (for script usage). -m Force MD5 encryption of the password (default). -B Force bcrypt encryption of the password (very secure). -C Set the computing time used for the bcrypt algorithm (higher is more secure but slower, default: 5, valid: 4 to 31). -d Force CRYPT encryption of the password (8 chars max, insecure). -s Force SHA encryption of the password (insecure). -p Do not encrypt the password (plaintext, insecure). -D Delete the specified user. -v Verify password for the specified user.