Linux配置ssh

Linux配置ssh,第1张

1、购买服务

2、加入安全组

3、修改实例名称,修改实例密码

1 查看ssh配置

2 安装SSH

3 启动服务

4 查看ssh服务的状态

输入以下命令:

5 在电脑终端输入

1.添加文件

2.添加公钥到文件内(id_rsa.pub)

3.编辑ssh配置文件:

4.重启sshd服务

5 在电脑终端输入

常见错误:

IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!

Someone could be eavesdropping on you right now (man-in-the-middle attack)!

It is also possible that a host key has just been changed.

The fingerprint for the ECDSA key sent by the remote host is

SHA256:sbd8mG3CPJc81mLgPPwLwVy7LF8qvUUuXisbcPKzTyE.

Please contact your system administrator.

Add correct host key in /Users/admin/.ssh/known_hosts to get rid of this message.

Offending ECDSA key in /Users/admin/.ssh/known_hosts:12

ECDSA host key for 47.96.118.128 has changed and you have requested strict checking.

Host key verification failed.

解决办法如下 输入

然后重新连接即可。

linux生成ssh1rsa主机键失败如下。

如果是selinux引起的话,可以先把selinux关掉,然后启动sshd,再把selinux打开 需要给一下sshd服务启动失败的日志才能分析原因,目前信息看不出来问题。

前面三行是把注释打开:#PasswordAuthentication yes--->PasswordAuthentication yes

第四行是替换#PermitRootLogin prohibit-password--->PermitRootLogin yes

--- a/network/openssh/Makefile

+++ b/network/openssh/Makefile

@@ -232,6 +232,10 @@ define Package/openssh-server/install

        chmod 0700 $(1)/etc/ssh

        $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/sshd_config $(1)/etc/ssh/

        sed -r -i 's,^#(HostKey /etc/ssh/ssh_host_(rsa|ecdsa|ed25519)_key)$$$$,\1,' $(1)/etc/ssh/sshd_config

+      sed -r -i 's,^#(PasswordAuthentication yes)$$$$,\1,' $(1)/etc/ssh/sshd_config

+      sed -r -i 's,^#(PermitEmptyPasswords no)$$$$,\1,' $(1)/etc/ssh/sshd_config

+      sed -r -i 's,^#(UsePAM no)$$$$,\1,' $(1)/etc/ssh/sshd_config

+      sed -i '/#PermitRootLogin /c PermitRootLogin yes' $(1)/etc/ssh/sshd_config

        $(INSTALL_DIR) $(1)/etc/init.d

        $(INSTALL_BIN) ./files/sshd.init $(1)/etc/init.d/sshd

        $(INSTALL_DIR) $(1)/usr/sbin


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/7086729.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-01
下一篇2023-04-01

发表评论

登录后才能评论

评论列表(0条)

    保存