033工作当中遇到的ssh错误

一、ssh端口ok,但是登录报错

(1)问题现象

root@:~/.ssh# ssh root@10.10.1.2
kex_exchange_identification: read: Connection reset by peer
root@:~/.ssh# nc -vz 10.10.1.2 22
Connection to 10.10.8.92 22 port [tcp/ssh] succeeded!

(2)添加一条类似Jenkins的allow配置即可;

root@10.10.1.2:~# cat /etc/hosts.deny

#Jenkins
sshd:10.10.1.6:allow
#默认全禁止
sshd:ALL

二、

[root@1bcc1d3f9666 externalscripts]# /usr/sbin/sshd
Could not load host key: /etc/ssh/ssh_host_rsa_key        解决参考:http://blog.csdn.net/hyholine/article/details/7362073
Could not load host key: /etc/ssh/ssh_host_ecdsa_key                   解决命令: ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key(https://linux.cn/article-4226-1.html)
Could not load host key: /etc/ssh/ssh_host_ed25519_key               解决命令:cd /etc/ssh  && ssh-keygen -A
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

解决linux中ssh登录Warning:Permanently added (RSA) to the list of known hosts

远程登录==>

[root@i-nbje0lea .ssh]# ssh 192.168.9.10
Warning: Permanently added '192.168.9.10' (RSA) to the list of known hosts.
Last login: Fri Sep 25 15:37:49 2015 from 192.168.9.11

Warning:Permanently added (RSA) to the list of known hosts错误

因:在执行ssh 时,没在本机的~/.ssh下生成known_hosts文件。

解决方案:
# vi/etc/ssh/ssh_config         //注意是客户端设置文件
最后有两行是
        StrictHostKeyChecking no             #登录时是否询问
        UserKnownHostsFile /dev/null     #表示隐藏known_hosts文件

两行解释如下:

StrictHostKeyChecking

If this flag is set to “yes”, ssh(1) will never automatically add host keys to the
             ~/.ssh/known_hosts file, and refuses to connect to hosts whose host key has changed.The default is “ask”.

UserKnownHostsFile
             Specifies a file to use for the user host key database instead of ~/.ssh/known_hosts.
把这两行注释掉并保存文件
再次执行ssh 192.168.9.10
出现提示

[admin@i-nbje0lea .ssh]$ ssh 192.168.9.10
The authenticity of host '192.168.9.10 (192.168.9.10)' can't be established.
RSA key fingerprint is 50:e9:44:87:86:c3:0f:85:ab:41:5e:33:1e:5b:6a:c1.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.9.10' (RSA) to the list of known hosts.
Last login: Fri Sep 25 15:27:34 2015 from 192.168.9.11

输入yes后,则可看到在/root/.ssh目录下生成了known_hosts文件:


[root@host100.ssh]# ls
id_rsa  id_rsa.pub  known_hosts

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

三、

报错: error: ssh: unexpected packet in response to channel open: <nil>

答:

(1)解决:
echo 1000000 | sudo tee /sys/fs/cgroup/pids/user.slice/user-1001.slice/pids.max


(2)解释:
/sys/fs/cgroup/pids/user.slice/user-1001.slice/pids.max 文件用于设置特定cgroup中的PID(进程ID)的最大数量限制。这个文件允许您限制在该cgroup中可以创建的进程数量,以防止资源过度使用或滥用。

默认情况下,pids.max 文件的默认值通常是系统默认的PID限制值或者是一个比较大的值(比如无限制)。这样可以确保在默认情况下不会对进程数量设置过于严格的限制。

如果您没有手动设置过该文件,那么默认值可能是系统默认值或者是一个比较大的值,以确保正常的进程创建和运行。您可以通过查看该文件的内容来确定当前的PID限制值。如果找不到该文件或者文件不存在,系统可能会采用默认的PID限制值。

如果您对PID限制有特定的要求,可以手动设置该文件中的值来调整PID的最大数量限制。请注意,对PID限制进行更改可能会影响系统的正常运行,因此请谨慎操作。

 

 
posted @ 2015-09-25 16:07  arun_yh  阅读(13394)  评论(0编辑  收藏  举报