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添加用户命令创建用户即可实现修改密码的功能。
htpasswd建立和更新存储用户名、密码的更多相关文章
- 【从业余项目中学习1】C# 实现XML存储用户名密码(MD5加密)
最近在写一个C#的项目,用户需求是实现Winform的多文档界面与Matlab算法程序之间的交互.做了一段时间发现,这既能利用业余时间,实战中也可学习一些技术,同时刚毕业也增加一份收入.所以后面会不断 ...
- 验证码的设计与记住我存储用户名密码cookie的技术及单选按钮选择登录人身份的实现
login.jsp页面 <head> <script type="text/javascript" src="js/captcha.js"&g ...
- svn服务器用户名密码更改后,如何更新本地用户名密码
在提交时,IDE会给出这样的提示,说明用户名密码已更改 在命令行输入 svn ls https:XXX(项目的地址),具体步骤如下图
- nginx配置访问密码,让用户输入用户名密码才能访问
如果我们在 nginx 下搭建了一些站点,但是由于站点内容或者流量的关系,我们并不想让所有人都能正常访问,那么我们可以设置访问认证.只有让用户输入正确的用户名和密码才能正常访问.效果如下: 在 ngi ...
- Android简易实战教程--第七话《在内存中存储用户名和密码》
首先是配置文件: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns ...
- git 解决每次更新代码都要输入用户名密码的解决方案
使用git pull或者git push每次都需要输入用户名和密码很繁琐,耽误时间,现在教大家一条命令实现保存用户名和密码不用再输入 git config --global credential.he ...
- git存储用户名和密码
git config --global credential.helper store 输入一次用户名和密码后,git会自动记录用户名密码
- 快Key:按一下鼠标【滚轮】,帮你自动填写用户名密码,快速登录,可制作U盘随身(开源免费-附安装文件和源代码)
* 代码以本文所附下载文件包为准,安装文件和源文件包均在本文尾部可下载. * 快Key及本文所有内容仅供交流使用,使用者责任自负,由快Key对使用者及其相关人员或组织造成的任何损失均由使用者自负,与本 ...
- Ansible批量更新远程主机用户密码 (包括Ansible批量做ssh互信)
按照集团运维信息安全制度, 需要每个一段时间对线上服务器密码进行一次变更,通过shell脚本部署比较繁琐,所以决定采用ansible脚本对远程主机root密码进行批量重置,该脚本已经在稳定运行在正式环 ...
随机推荐
- SNP(单核苷酸多态性)准确性的验证,你造吗?
SNP(单核苷酸多态性)准确性的验证,你造吗? [2016-12-12] SNP(全称Single Nucleotide Polymorphisms)即单核苷酸多态性,主要是指在基因组水平 ...
- C++点和箭头操作符用法区别
变量是对象的时候用“.”访问 变量是对象指针的时候用“->”访问 例: #inlclude <iostream> using namespace std; class A { pub ...
- Laravel 5.5 + Vue 开发单页应用
上次我用 laravel5.3 + Vue 开发了一个简单的单页应用,这次我打算将其升级到 laravel5.5,在升级的过程中,做一下记录,其源码放在 github 上面,源码地址 开发环境 软 ...
- Netty 源码 Channel(一)概述
Netty 源码 Channel(一)概述 Netty 系列目录(https://www.cnblogs.com/binarylei/p/10117436.html) Channel 为 Netty ...
- js,jquery的数字型字符串变量比较大小
转:http://blog.csdn.net/dxnn520/article/details/8267173 var定义的变量应该是字符串,有时没有经过类型转换而进行比较的话,小于十的话还可以,如果大 ...
- [ES]ES查询指南
我们通常用用_cat API检测集群是否健康. 确保9200端口号可用: curl 'localhost:9200/_cat/health?v' 绿色表示一切正常, 黄色表示所有的数据可用但是部分副本 ...
- asio的网络通讯代码练手
asio的网络基本模板(单例模式 消息队列 ) // MyAsio.cpp: 定义控制台应用程序的入口点. // #include "stdafx.h" #include < ...
- so文件相关
2018-08-31 今天尝试了一下编译so文件. 最开始是按照这个博主来操作的https://blog.csdn.net/tianshuai4317618/article/details/79073 ...
- jsvascript null,undefined,undeclared的区别
1.undefined表示"缺少值",就是此处应该有一个值,但是还没有定义,转为数值时为NaN.典型用法是: (1)变量被声明了,但没有赋值时,就等于undefined. (2) ...
- jrebel
jrebel 编辑 JRebel是一套JavaEE开发工具.JRebel允许开发团队在有限的时间内完成更多的任务修正更多的问题,发布更高质量的软件产品. JRebel是收费软件,用户可以在JReb ...