环境:openstack rocky,centos7.6 镜像
“项目”–“实例”–“创建实例”–“配置”–“选择文件”
文件内容如下:
#!/bin/bash
#change password
passwd root<<EOF
hao@123
hao@123
EOF
#allow ssh password login and no use dns
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/g' /etc/ssh/sshd_config
sed -i 's/#UseDNS yes/UseDNS no/g' /etc/ssh/sshd_config
systemctl restart sshd