D
D
dmitrij_hort2017-04-07 18:07:29
CentOS
dmitrij_hort, 2017-04-07 18:07:29

CentOS 7 kickstart and password in md5 not working?

Actually the question, earlier, in version 5-6, worked, asked

rootpw --iscrypted HASH # Генерируем с помощью  php crypt()
authconfig --enableshadow --passalgo=md5 
authconfig --passalgo=sha512 --update # меняем на sha512

It doesn't work now, what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
younghacker, 2017-04-08
@younghacker

I have a script that creates kickstarts and does it like this:

read -p "Enter root password or leave empty for random: " ROOT_PW
  if [ -z "${ROOT_PW}" ] ; then
    # генерируем пароль для root
    ROOT_PW=`tr -dc A-Za-z0-9_ < /dev/urandom | head -c 15 | xargs`
  fi
  # шифруем пароль так
  ROOT_PW_SALT=`tr -dc A-Za-z0-9_ < /dev/urandom | head -c 16 | xargs`
  ROOT_PWCRYPTED=`echo -e "${ROOT_PW}\n${ROOT_PW_SALT}" | python -c 'import crypt; print crypt.crypt(raw_input(), "\$6\$" + raw_input() + "\$")'`
....
KSFILE=`cat <<EOFINLINEFILE
text
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp --hostname ${HOST_NAME}
rootpw --iscrypted ${ROOT_PWCRYPTED}
authconfig --enableshadow --passalgo=sha512
firewall --service=ssh
selinux --permissive
timezone --utc Etc/UTC
....

An encrypted password can also be generated like this:
echo -e "${ROOT_PW}" | python -c 'import crypt; print(crypt.crypt(raw_input(), crypt.mksalt(crypt.METHOD_SHA512)))'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question