【问题标题】:Automate Htpasswd command with variables for username and password使用用户名和密码变量自动执行 Htpasswd 命令
【发布时间】:2017-03-13 23:15:50
【问题描述】:

我正在尝试通过脚本中的变量传递用户名和密码:

htpasswd -b -c /etc/apache2/.htpasswd $HtUser $HtPwd

其中 HtUser 和 HtPwd 是在脚本前面填充的变量。我尝试了以下...

htpasswd -b -c /etc/apache2/.htpasswd '$HtUser' '$HtPwd'

但设置用户为“$HtUser”,密码为“$HtPwd”。

有什么建议吗?

【问题讨论】:

    标签: web apache2 ubuntu-16.04 .htpasswd


    【解决方案1】:

    如果要插入变量,请在 shell 中使用双引号,或者根本不使用引号。单引号不起作用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-11-07
      • 1970-01-01
      • 2019-04-03
      • 2013-01-10
      • 2014-08-03
      • 2021-01-22
      • 2015-06-28
      • 1970-01-01
      相关资源
      最近更新 更多