htpasswd 详解
Apache htpasswd命令用法详解
htpasswd建立和更新存储用户名、密码的文本文件, 用于对HTTP用户的basic认证。
# /usr/local/apache/bin/htpasswd --help
Usage:
htpasswd [-cmdpsD] passwordfile username
htpasswd -b[cmdpsD] passwordfile username password htpasswd -n[mdps] username
htpasswd -nb[mdps] username password
-c Create a new file.
-n Don't update file; display results on stdout.
-m Force MD5 encryption of the password (default).
-d Force CRYPT encryption of the password.
-p Do not encrypt the password (plaintext).
-s Force SHA encryption of the password.
-b Use the password from the command line rather than prompting for it.
-D Delete the specified user.
On other systems than Windows, NetWare and TPF the '-p' flag will probably not work.
The SHA algorithm does not use a salt and is less secure than the MD5 algorithm.
htpasswd参数
-c 创建passwdfile.如果passwdfile 已经存在,那么它会重新写入并删去原有内容.
-n 不更新passwordfile,直接显示密码
-m 使用MD5加密(默认)
-d 使用CRYPT加密(默认)
-p 使用普通文本格式的密码
-s 使用SHA加密
-b 命令行中一并输入用户名和密码而不是根据提示输入密码,可以看见明文,不需要交互
-D 删除指定的用户
实例
1. 如何利用htpasswd命令添加用户?
# /usr/local/apache/bin/htpasswd -bc linuxeye_pd linuxeye_user linuxeye_password
Adding password for user linuxeye_user
# cat linuxeye_pd
linuxeye_user:$apr1$Mugpp3FE$zGsi7/JfQIhFXPlgqo/Wx/
生成当前目录下生成一个linuxeye_pd文件,用户名linuxeye_user,密码:linuxeye_password,默认采用MD5加密方式
2. 如何在原有密码文件中增加下一个用户?
# /usr/local/apache/bin/htpasswd -b linuxeye_pd linuxeye.com linuxeye.com
Adding password for user linuxeye.com
# cat linuxeye_pd
linuxeye_user:$apr1$Mugpp3FE$zGsi7/JfQIhFXPlgqo/Wx/
linuxeye.com:$apr1$/8EUOPYI$4MBxYpzotrSDcTTDZvTeT0
一定要去掉-c选项,否则覆盖密码文件再创建
3. 如何不更新密码文件,只显示加密后的用户名和密码?
# /usr/local/apache/bin/htpasswd -n linuxeye
New password:
Re-type new password:
linuxeye:$apr1$bZ6Gclc4$zKRap.0BADzZIxLoxpDNv0 # /usr/local/apache/bin/htpasswd -nb linuxeye linuxeye_password
linuxeye:$apr1$yvngdKGV$QrnlriJ.MxIu52Vmo.ROE1
4. 如何利用htpasswd命令删除用户名和密码?
# /usr/local/apache/bin/htpasswd -D linuxeye_pd linuxeye_user
Deleting password for user linuxeye_user
# cat linuxeye_pd
linuxeye.com:$apr1$/8EUOPYI$4MBxYpzotrSDcTTDZvTeT0
5. 如何利用htpasswd命令修改密码?
# /usr/local/apache/bin/htpasswd -D linuxeye_pd linuxeye.com
Deleting password for user linuxeye.com
# /usr/local/apache/bin/htpasswd -b linuxeye_pd linuxeye.com linuxeye_passwd
Adding password for user linuxeye.com
# cat linuxeye_pd
linuxeye.com:$apr1$74ZvB1vC$/b7ETmg8xhDPieYj0b0cE.
需要先利用htpasswd命令删除指定用户,再利用htpasswd添加用户命令创建用户即可实现修改密码的功能。
文章转自:https://blog.linuxeye.com/333.html
htpasswd 详解的更多相关文章
- Nginx配置文件nginx.conf中文详解(转)
######Nginx配置文件nginx.conf中文详解##### #定义Nginx运行的用户和用户组 user www www; #nginx进程数,建议设置为等于CPU总核心数. worker_ ...
- Nginx配置文件详解
Nginx是一款面向性能设计的HTTP服务器,相较于Apache.lighttpd具有占有内存少,稳定性高等优势. ######Nginx配置文件nginx.conf中文详解##### #定义Ngin ...
- Nginx中文详解、配置部署及高并发优化
一.Nginx常用命令: 1. 启动 Nginx /usr/local/nginx/sbin/nginxpoechant@ubuntu:sudo ./sbin/nginx2. 停 ...
- Nginx配置文件(nginx.conf)配置详解(2)
Nginx的配置文件nginx.conf配置详解如下: user nginx nginx ; Nginx用户及组:用户 组.window下不指定 worker_processes 8; 工作进程:数目 ...
- apache 虚拟主机详细配置:http.conf配置详解
apache 虚拟主机详细配置:http.conf配置详解 Apache的配置文件http.conf参数含义详解 Apache的配置由httpd.conf文件配置,因此下面的配置指令都是在httpd. ...
- (原创)LAMP搭建之二:apache配置文件详解(中英文对照版)
LAMP搭建之二:apache配置文件详解(中英文对照版) # This is the main Apache server configuration file. It contains the # ...
- Nginx配置文件(nginx.conf)配置详解
Nginx的配置文件nginx.conf配置详解如下: user nginx nginx ; Nginx用户及组:用户 组.window下不指定 worker_processes 8; 工作进程:数目 ...
- 【转】nginx服务器安装及配置文件详解
原文:http://seanlook.com/2015/05/17/nginx-install-and-config/ nginx服务器安装及配置文件详解 nginx在工作中已经有好几个环境在使用了, ...
- Nginx配置文件nginx.conf中文详解【转】
PS:Nginx使用有两三年了,现在经常碰到有新用户问一些很基本的问题,我也没时间一一回答,今天下午花了点时间,结合自己的使用经验,把Nginx的主要配置参数说明分享一下,也参考了一些网络的内容,这篇 ...
随机推荐
- css3 animation动画技巧
一,css3 animation动画前言 随着现在浏览器对css3的兼容性越来越好,使用css3动画来制作动画的例子也越来越广泛,也随着而来带来了许多的问题值得我们能思考.css3动画如何让物体运动更 ...
- NOIP2008 T3 传纸条 解题报告——S.B.S.
题目描述 小渊和小轩是好朋友也是同班同学,他们在一起总有谈不完的话题.一次素质拓展活动中,班上同学安排做成一个m行n列的矩阵,而小渊和小轩被安排在矩阵对角线的两端,因此,他们就无法直接交谈了.幸运的是 ...
- OpenCV 之 数字图像
1 数字图像 数字图像可看作一个数值矩阵, 其中的每个元素代表一个像素点,如下图所示: 2 存储 M行N列图像的存储位数: b = M * N * k ( L=2k, l ∈ [0, L-1] ...
- codeforces 709D D. Recover the String(构造)
题目链接: D. Recover the String time limit per test 1 second memory limit per test 256 megabytes input s ...
- UVALive 5962 Strongly Connected Chemicals --最大独立集
题意:给n个阳离子和m个阴离子,并给出相互的吸引关系,求一个最大的点集,使其中的每个阴阳离子相互吸引. 解法:枚举每条边,使该条边存在,然后建立反图,求一个最大匹配,此时的点数减去最大匹配与ans求一 ...
- LYK 快跑!(LYK别打我-)(话说LYK是谁)
LYK 快跑!(run) Time Limit:5000ms Memory Limit:64MB 题目描述 LYK 陷进了一个迷宫! 这个迷宫是网格图形状的. LYK 一开始在(1,1)位置, 出口在 ...
- 【转载】Jmeter获取响应结果中参数出现的次数
在测试中,有时候会遇到要统计响应结果中某个参数出现了多少次,如果量级很大,一个一个数不太现实,下面讲一下实现自动打印出该参数出现的次数的方法. 例如我的响应信息为:{"ip":&q ...
- 创建租房网House脚本
USE MASTER GO EXEC XP_CMDSHELL 'MKDIR E:\HOUSE1' GO SET NOCOUNT ON----不显示影响行数 IF EXISTS(SELECT * FRO ...
- action中result没有值
action中result没有值,访问action会输出action中的所有数据,输出类型为.action类型 .
- 23Spring_JdbcTemplate来实现单表的增删改查
第一步建表: