zoukankan      html  css  js  c++  java
  • Linux基础命令---htpasswd创建密码文件

    htpasswd

          htpasswd指令用来创建和更新用于基本认证的用户认证密码文件。htpasswd指令必须对密码文件有读写权限,否则会返回错误码。

          此命令的适用范围:RedHat、RHEL、Ubuntu、CentOS、Fedora。

    1、语法

          htpasswd [ -c ]  [ -m ]  [ -D ]  passwdfile username

          htpasswd  -b  [ -c ]  [ -m | -d | -p | -s ] [ -D ]  passwdfile  username  password

          htpasswd -n  [ -m | -d | -s | -p ]  username

          htpasswd -nb  [ -m | -d | -s | -p ]  username  password

     

    2、参数列表

    选项

    说明

    -b

    使用批处理方式,直接从命令行获取密码,不提示用户输入

    -c

    创建密码文件,如果文件存在,那么内容被清空重写

    -n

    将结果送到标准输出

    -m

    使用MD5加密

    -s

    使用crypt()加密

    -p

    使用文本密码

    -D

    从认证文件中删除用户记录

     

    3、实例

    1)创建基本认证文件 

    [root@localhost ~]# htpasswd -cm htpfile1 weijie        //创建认证文件,使用md5加密

    New password: 

    Re-type new password: 

    Adding password for user weijie 

    You have new mail in /var/spool/mail/root

    [root@localhost ~]# cat htpfile1                           //显示认证文件

    weijie:$apr1$/RxQ5LT9$L1WJPkxknMizG5DwGVGv4.

    2)创建基本认证文件,使用文本密码

    [root@localhost ~]# htpasswd -cp htpfile2 weijie       //创建认证文件,使用文本密码

    Warning: storing passwords as plain text might just not work on this platform.

    New password: 

    Re-type new password: 

    Adding password for user weijie

    [root@localhost ~]# cat htpfile2                           //查看认证文件,可以看到密码

    weijie:123456

    做了一个Linux学习的平台,目前出来一个雏形,各位可以参考使用
    链接:https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ 密码:n7bk

  • 相关阅读:
    Swift学习-Property
    Swift学习-protocol
    Swift学习-Class
    Swift学习-Enumerate、Structure
    iOS“此时无法下载应用”解决办法
    iTunes Connect用户职能与权限
    TestFlight Beta Testing 开发指南中英对照
    梳理一下KVC
    mac下使用github 上传代码(转)
    运用Runtime全局修改UILabel的默认字体
  • 原文地址:https://www.cnblogs.com/wj78080458/p/10847976.html
Copyright © 2011-2022 走看看