加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

shell之批量新增用户脚本(http-basic-auth)

发布时间:2020-12-15 07:06:24 所属栏目:安全 来源:网络整理
导读:user.txt(用户名记录文件) test001@ 163 .comtest002@ 163 .com user.sh(shell脚本): for line in `cat user.txt` do echo $line " u " $line printf $line:$(openssl passwd -crypt $line)n " conf.d/ passwddone 执行完毕后,就可以在passwd看到对应的记

user.txt(用户名记录文件)

test001@163.com
test002@163.com

user.sh(shell脚本):

for line in `cat user.txt`
do
   echo $line "u"$line
   printf $line:$(openssl passwd -crypt $line)n" >> conf.d/passwd

done

执行完毕后,就可以在passwd看到对应的记录。

应用场景:
比如我开发某个系统,希望有一个双重验证,第一次访问比如有一个HTTP Basic Auth认证(认证一次,浏览器有缓存,就无需再重新验证),第二次如果你想使用系统的服务的话,还需要登录。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读