sh设置密码和启用root登录:
#!/bin/bash -ex
sudo echo "密码" | sudo passwd --stdin root
sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
sudo sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config
sudo sed -i 's/UsePAM no/UsePAM yes/' /etc/ssh/sshd_config
sudo /sbin/service sshd