Script Kerberos Ktutil to make keytabs

前端 未结 4 703
庸人自扰
庸人自扰 2021-02-03 10:50

I want to make a script that will generate the a keytab using ktutil. When running the script I want to use [user]$ script.sh PASSWORD

#script.sh
echo \"addent -         


        
4条回答
  •  悲&欢浪女
    2021-02-03 11:41

    With 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
    

    Output:

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

提交回复
热议问题