Script Kerberos Ktutil to make keytabs

前端 未结 4 705
庸人自扰
庸人自扰 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:22

    To create the multiple orgs keytabs and default hbase,pipe,hdfs keytab at the same time you can run the below script, which i have just created:

    #!/bin/bash
    read -p "Please enter space-delimited list of ORGS to create: " NEW_ORGS
    
    clear
    #echo "#################  CREATE KEYTABS  ############################"
    #echo ""
    kdestroy
    
    for i in $NEW_ORGS
    do
         printf "%b" "addent -password -p ${i} -k 1 -e aes256-cts-hmac-sha1-96\n${i}\nwrite_kt ${i}.keytab" | ktutil
    
         printf "%b" "read_kt ${i}.keytab\nlist" | ktutil
    
    done
    echo ""
    
    
    if [ ! -e /home/eip/.keytabs/hbase.keytab ]
    then
            printf "%b" "addent -password -p hbase -k 1 -e aes256-cts-hmac-sha1-96\nhbase\nwrite_kt hbase.keytab" | ktutil
    
            printf "%b" "read_kt hbase.keytab\nlist" | ktutil
    fi
    
    exit 0
    

提交回复
热议问题