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密码进行批量重置,该脚本已经在稳定运行在正式环 ...
随机推荐
- Oracle VM VirtualBox如何设置网络地址转换NAT
使用VirtualBox 安装好服务器后,需要设置网络,如果有IP, 则可以直接连接物理网络了, 如果没有,则可以直接使用NAT网络.设置方便快速. 先将虚拟机中的网络设置为自动获取,然后点击Virt ...
- NC 5系自定义显示公式
1.继承NcInnerFunction(nc.vo.pub.formulaset.function.NcInnerFunction) 在方法中引用父类方法function,并在里面写方法 @Overr ...
- Laravel 5.5 + Vue 开发单页应用
上次我用 laravel5.3 + Vue 开发了一个简单的单页应用,这次我打算将其升级到 laravel5.5,在升级的过程中,做一下记录,其源码放在 github 上面,源码地址 开发环境 软 ...
- How to reconfigure installed dpkg package (tzdata, locales)
1 List the installed dpkg package $ sudo dpkg --list 2 Reconfigure the package $ sudo dpkg-reconfigu ...
- Spring 是如何解析泛型 - ResolvalbeType
Spring 是如何解析泛型 - ResolvalbeType Spring 系列目录(https://www.cnblogs.com/binarylei/p/10198698.html) Java ...
- mysql mariadb的VC客户端遇到的问题
在使用VS2017编写数据库客户端 具体设置可参见以下内容 https://dev.mysql.com/doc/connector-cpp/en/connector-cpp-apps-windows- ...
- spring学习 十三 注解AOP
spring 不会自动去寻找注解,必须告诉 spring 哪些包下的类中可能有注解,也就是要开启注解扫描,注解的包是spring-context.jar,所以在配置文件中还要引入context约束,也 ...
- hdu 2588(简单的欧拉
题意:给你一个n,m问你1-n里面(x)有多少对gcd(x, n)>=m. 思路:我们可以设n=a*b, x=a*c,此时我们可以知道b,c是互质的,那么就可以用欧拉来求解 /* gyt Liv ...
- java JNI 实现原理 (二) Linux 下如何 load JNILibrary
在博客java JNI (一)虚拟机中classloader的JNILibrary 中讨论了java中的Library 是由classloader 来load的,那我们来看看 classloader是 ...
- 2019.01.02 bzoj5300: [Cqoi2018]九连环(fft优化高精+快速幂)
传送门 题意不好描述(自己看样例解释) 首先可以推出一个递推式:fn=fn−1+2fn−2+1f_n=f_{n-1}+2f_{n-2}+1fn=fn−1+2fn−2+1 然后可以构造两个等式: ...