bash - 编写 Kerberos Ktutil 脚本来制作 key 表

标签 bash passwords pipe kerberos keytab

我想制作一个脚本,使用 ktutil 生成 key 表。运行我想使用的脚本时 [用户]$ script.sh 密码

#script.sh
echo "addent -password -p PRINCIPAL -k 1 -e aes256-cts-hmac-sha1-96" | ktutil

Ktutil 需要密码,这里我想使用上面的 PASSWORD 参数。我将如何通过密码争论?

最佳答案

使用 GNU bash:

user="PRINCIPAL"
pass="topsecret"

printf "%b" "addent -password -p $user -k 1 -e aes256-cts-hmac-sha1-96\n$pass\nwrite_kt $user.keytab" | ktutil

printf "%b" "read_kt $user.keytab\nlist" | ktutil

输出:

slot KVNO Principal
---- ---- ---------------------------------------------------------------------
   1    1                          PRINCIPAL@YOURDOMAIN

关于bash - 编写 Kerberos Ktutil 脚本来制作 key 表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37454308/

相关文章:

c++ - 如何使用户可变常量?

windows - 如何以编程方式更改我的 Windows 域密码?

bash - 无法从 bash 脚本更改文件所有权

regex - 如何将 BASH 变量插入到 PERL 正则表达式替换中?

bash - 将 postgresql 结果存储在 bash 变量中

macos - Bash:管道输出到后台进程?

c - 使用管道将多个字符串发送到子进程

linux - 从键值文件中提取版本并在单个命令中替换为 html 文件

java - Spring Security 和 BCryptPasswordEncoder 用于注册和登录

c - 为什么代码显示写入管道不能确保原子性?