ssh 连接不上 oracle linux 7.2

问题描述

oralce linux 可以ssh到其他设备,可是其他设备ssh不上oracle linux

ssh username@hostip -v

OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug1: Connecting to 192.168.100.27 [192.168.100.27] port 2222.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
Read from socket failed: Connection reset by peer
原因

linux oracle /etc/ssh 目录下默认没有 ssh_host_rsa_key,ssh_host_ecdsa_key,ssh_host_ed25519_key
这三个公私钥文件

解决

ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key
systemctl restart sshd

提示输入密码时直接按 enter 键就行了,也可以在 ssh-keygen 中使用 -P选项 指定使用什么密码

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
当无法通过SSH连接Linux服务器时,可能是由于以下一些常见问题导致的: 1. 网络连接问题:首先,确保本地计算机与Linux服务器在同一个局域网中,或者确保能够通过Internet连接到服务器的公共IP地址。检查本地计算机的网络设置,并尝试通过ping命令来测试与服务器的连通性。 2. SSH服务未运行:确保Linux服务器上的SSH服务正在运行。可以使用以下命令检查SSH服务的状态: ``` systemctl status ssh ``` 如果服务未运行,可以使用以下命令启动SSH服务: ``` sudo systemctl start ssh ``` 3. 防火墙设置:检查服务器上的防火墙设置,确保其允许SSH连接。默认情况下,Linux的防火墙通常允许SSH连接,但有时可能需要手动配置。如果服务器上有防火墙,可以使用以下命令检查以及开启SSH端口(默认为22): ``` sudo ufw status sudo ufw allow ssh ``` 4. SSH配置问题:检查服务器上的SSH配置文件,通常为`/etc/ssh/sshd_config`。确保以下项的设置正确: - SSH端口(默认为22) - 允许的SSH用户或用户组 - 是否允许使用密码或密钥进行身份验证 如果有任何更改,请重启SSH服务以使更改生效: ``` sudo systemctl restart ssh ``` 5. 身份验证问题:如果尝试使用密钥进行身份验证,请确保本地计算机上的私钥文件具有正确的权限(通常为600)。另外,也可以尝试使用用户名和密码进行身份验证。 如果以上步骤都没有解决问题,可能还需要检查服务器的系统日志文件(通常为/var/log/auth.log或/var/log/secure)以获取更多详细信息,并尝试确认SSH服务的正确配置和运行状态。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值