Linux开启SSH密码登录

CentOS和Debian通用

1
2
3
sed -i 's/PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
service sshd restart

Ubuntu系统

1
2
3
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
service sshd restart

Oracle Ubuntu 24.04.1 LTS还要修改

1
vim /etc/ssh/sshd_config.d/60-cloudimg-settings.conf

安装ssh

1
sudo apt-get install openssh-server