linux ssh连接问题总结与解决方案
ssh连接被用于各种linux连接场合,今天在配置的时候遇到一些问题,做出以下说明:
问题一:
[root@linuxpcom ~]# vim /etc/ssh/sshd_config
[root@linuxpcom ~]# systemctl restart sshd
时 出现Job for sshd.service failed because the control process exited with error code. See "systemctl status sshd.service" and "journalctl -xe" for details. 报错;八成是在配置文件时候手误敲进去特殊符号,或者加入了各种非法指令;解决方案找找刚刚输入的上下左右几行有无错误;
方案二:由于sshd_config要修改的命令用#号给你注释了,所以偷懒写法 echo “命令行”>> /etc/ssh/sshd_config
问题二:
[root@linuxpcom ~]#ssh 192.168.1.*
##这里192.168.1.*指的你想连接的地址
出现报错 Permission denied (publickey,gssapi-keyex,gssapi-with-mic),这是因为你没有配置公钥,就把 /etc/ssh/sshd_config 文件的PasswordAuthentication 打开了。
解决方案,给它注释掉就好,重启systemctl restart sshd 后再执行ssh。或者先ssh-keygen配置密钥对。ssh就通了。
下一期::ssh连接