如何修改Linux系统的 etcsshsshd

如何修改Linux系统的 etcsshsshd,第1张

Linux的ssh设置需要修改ssh的配置文件sshd_config,输入命令:vi /etc/ssh/sshd_config

在这个文件中,将PermitRootLogin without-password这一行修改为PermitRootLogin yes,这一行的意思是“允许root用户用ssh登录”。

再去掉#PasswordAuthentication no这一行的注释符号#,并把no改为yes,表示用ssh登录时需要密码认证。

修改完配置文件后就可以启动SSH服务了,启动命令为:/etc/init.d/ssh start

新版的opensshd

中添加了Ed25519

做签名验证,而之前系统里没这个算法的证书,所以办法也很简单新生成下证书即可。

ssh-keygen

-t

ed25519

-f

/etc/ssh/ssh_host_ED25519_key

输入命令/etc/init.d/ssh

start后出现提示:

Could

not

load

host

key:

/etc/ssh/ssh_host_ED25519_key

然后直接输入ssh-keygen

-t

dsa

-f

/etc/ssh/ssh_host_ED25519_key

重启ssh,然后就好了

上面就是Linux启动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://outofmemory.cn/tougao/6059028.html

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

发表评论

登录后才能评论

评论列表(0条)

保存