项目场景:
Linux下虚拟机Debian10开启SSH服务
问题描述:
无法通过SSH远程连接,需要开启或下载SSH服务
解决方案:
1.安装ssh服务
sudo apt-get update #更新软件源
sudo apt-get install ssh #安装
2.修改sshd_config文件,命令为:vi /etc/ssh/sshd_config
将#PasswordAuthentication no
的注释去掉,并且将no修改为yes
将#PermitRootLogin prohibit-password
的注释去掉,将prohibit-password
改为yes
PasswordAuthentication yes
PermitRootLogin yes
或echo -e “PasswordAuthentication yes\nPermitRootLogin yes” >> /etc/ssh/sshd_config
3.启动SSH服务,命令为:
/etc/init.d/ssh start // 或者service ssh start
4.验证SSH服务状态,命令为:
/etc/init.d/ssh status
5. 添加开机自启动
update-rc.d ssh enable
关闭SSH命令
update-rc.d ssh disabled #重启后生效
reboot #重启