0

I need to deploy a CentOs Cloud Image on private server(kind of bare metal server). So i download CentOS cloud image and customize it with virt-customize having SSH enabled with Password Authentication by running build_script.sh having following commands.

distro=$1
config_dir=$2
if [[ -z $distro ]]; then
  echo "USAGE: $0 image_path config_dir"
  exit 0
fi
if [[ -z $config_dir ]]; then
  echo "USAGE: $0 image_path config_dir"
  exit 0
fi
sudo virt-customize --install openssh-server -a $distro
sudo virt-customize --install openssh-clients -a $distro 
sudo virt-customize --run-command 'systemctl enable sshd' -a $distro 
sudo virt-customize --mkdir /var/ssh/ -a $distro
sudo virt-customize --copy-in $config_dir/sshd_config:/etc/ssh/ -a $distro
sudo virt-customize --run-command 'systemctl start sshd' -a $distro 

And sshd_config looks like

ClientAliveInterval 360
ClientAliveCountMax 0
PermitEmptyPasswords no
PermitRootLogin no
PasswordAuthentication yes

Before deploying and booting up i have manually verified that sshd_config is having these values but, when it boots up the configuration change PasswordAuthenticatin yes to PasswordAuthentication no. What is changing this, i am not able to debug. Thanks in advance for Helping.

0

To allow console connection with ssh (login without password) you need to add the following command. Your problem will be resolved.

virt-customize -a /img/$VM_NAME.qcow2  --run-command 'echo PermitRootLogin yes >> /etc/ssh/sshd_config'

Not the answer you're looking for? Browse other questions tagged or ask your own question.