Update rebuild_qcow2.sh

This commit is contained in:
spiritLHLS 2023-04-18 10:15:18 +08:00 committed by GitHub
parent acf0fc8b77
commit e8cfa668c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,6 +25,8 @@ virt-customize -a $qcow_file --run-command "echo '--by https://t.me/spiritlhl' >
echo "启用SSH功能..." echo "启用SSH功能..."
virt-customize -a $qcow_file --run-command "systemctl enable ssh" virt-customize -a $qcow_file --run-command "systemctl enable ssh"
virt-customize -a $qcow_file --run-command "systemctl start ssh" virt-customize -a $qcow_file --run-command "systemctl start ssh"
virt-customize -a $qcow_file --run-command "systemctl enable sshd"
virt-customize -a $qcow_file --run-command "systemctl start sshd"
echo "启用root登录..." echo "启用root登录..."
virt-customize -a $qcow_file --run-command "sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config" virt-customize -a $qcow_file --run-command "sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config"
virt-customize -a $qcow_file --run-command "sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config" virt-customize -a $qcow_file --run-command "sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config"
@ -34,7 +36,9 @@ virt-customize -a $qcow_file --run-command "sed -i 's/#AddressFamily any/Address
virt-customize -a $qcow_file --run-command "sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/g' /etc/ssh/sshd_config" virt-customize -a $qcow_file --run-command "sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/g' /etc/ssh/sshd_config"
virt-customize -a $qcow_file --run-command "sed -i 's/#ListenAddress ::/ListenAddress ::/g' /etc/ssh/sshd_config" virt-customize -a $qcow_file --run-command "sed -i 's/#ListenAddress ::/ListenAddress ::/g' /etc/ssh/sshd_config"
virt-customize -a $qcow_file --run-command "service ssh restart" virt-customize -a $qcow_file --run-command "service ssh restart"
virt-customize -a $qcow_file --run-command "service sshd restart"
virt-customize -a $qcow_file --run-command "systemctl restart sshd" virt-customize -a $qcow_file --run-command "systemctl restart sshd"
virt-customize -a $qcow_file --run-command "systemctl restart ssh"
echo "创建备份..." echo "创建备份..."
cp $qcow_file ${qcow_file}.bak cp $qcow_file ${qcow_file}.bak
echo "复制新文件..." echo "复制新文件..."