sudo -i
passwd 需要输入两次密码,并且密码不会显示出来,输入后直接回车即可
CentOS和Debian通用,输入以下两条命令
sed -i 's/PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
Ubuntu系统,输入以下两条命令
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
重启SSH服务
/etc/init.d/ssh restart
vi /etc/ssh/sshd_config
i
PermitRootLogin yes //默认为no,需要开启root用户访问改为yes PasswordAuthentication yes //默认为no,改为yes开启密码登陆
:wq
/etc/init.d/ssh restart