标准的操作

1、修改sshd_config文件,命令为:vi /etc/ssh/sshd_config

2、将#PasswordAuthentication no的注释去掉,并且将no修改为yes

3、将#PermitRootLogin prohibit-password的注释去掉,将prohibit-password改为yes

4、启动SSH服务,命令为:/etc/init.d/ssh start // 或者service ssh start

5、验证SSH服务状态,命令为:/etc/init.d/ssh status

6. 添加开机自启动 update-rc.d ssh enable

快速模式

直接使用cat命令在sshd_config文件尾部追加所需要的内容就行,反正上面都是#注释的,不会造成任何冲突。

cat >> /etc/ssh/sshd_config << EOF
PasswordAuthentication yes
PermitRootLogin yes
EOF
service ssh restart