| Use Case | Command | Description |
|---|---|---|
| Create new password database | htpasswd = WEBrick::HTTPAuth::Htpasswd.new 'filename' |
Create a new Htpasswd object for a file |
| Set a user's password | htpasswd.set_passwd 'realm', 'username', 'password' |
Set password for a user in a realm |
| Save changes to disk | htpasswd.flush |
Write current password database to file |
| Delete a user | htpasswd.delete_passwd 'realm', 'username' |
Remove a user from the database |
| Retrieve password | htpasswd.get_passwd 'realm', 'username' |
Get password for a user (returns nil if not found) |
UserDB (from /home/chedong/.local/share/rdoc)
Htpasswd accesses apache-compatible password files. Passwords are matched to a realm where they are valid. For security, the path for a password database should be stored outside of the paths available to the HTTP server.
Htpasswd is intended for use with WEBrick::HTTPAuth::BasicAuth.
To create an Htpasswd database with a single user:
htpasswd = WEBrick::HTTPAuth::Htpasswd.new 'my_password_file'
htpasswd.set_passwd 'my realm', 'username', 'password'
htpasswd.flush
newdelete_passwdeachflushget_passwdreloadset_passwdGenerated by phpman v4.9.26-1-g511901d · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-08-02 12:00 @216.73.217.9
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format