linux debian安装ssh,Debian8 Linux上安装SSH服务器并配置sshd_config文件&启用root ssh登录...

Debian Linux上安装SSH服务器

安装SSH服务器debian Linux允许我们通过ssh协议登录debian服务器。SSH是从远程位置登录debian的首选方法,因为ssh协议通过Internet提供安全的加密连接。

在本教程中我们将学习如何在Debian 8.3上安装SSH服务器。

debian 8.3的SSH服务器由openssh-server软件包提供。我们可以使用apt-get install命令在debian Linux上安装openssh-server。

在Debian 8上安装openssh服务器

首先使用apt-get update命令更新apt源列表。

apt-get update

然后使用apt-get install命令在debian上安装openssh服务器。

apt-get install openssh-server

现在启动并启用debian ssh服务器以在系统重启时启动。

systemctl start ssh.service

systemctl启用ssh.service

还运行netstat命令以确保ssh端口22已打开并正在运行。

netstat -tulnp | grep 22

fa38e62f82b8792069633c8ae5b5b994.png

您可以使用systemctl命令查看ssh服务器的状态。

systemctl status ssh.service

3153bda844fe6dbd2afa38a8b1e76cdc.png

在Debian上启用root ssh登录

默认情况下,Debian Linux不允许以root用户身份通过​​SSH协议登录服务器。已从主ssh配置文件中禁用Debian ssh root登录。如果您尝试以root用户身份登录,则会收到错误消息“权限被拒绝,请再试一次”。

出于安全原因,允许SSH root访问是不好的做法。但是为了你的知识,让我们看看它是如何完成的。

在sshd_config文件中设置PermitRootLogin yes

/ etc / ssh / sshd_config文件中的PermitRootLogin参数控制ssh root权限。默认情况下,Debian Linux中PermitRootLogin的值为“without-password”。要允许root登录,我们需要将PermitRootLogin设置为yes。

首先使用文本编辑器打开ssh配置文件。

vim  /etc/ssh/sshd_config

然后将PermitRootLogin的值更改为yes

PermitRootLogin yes

12ea5d05acb3a22eaddc87e4515d49c8.png

然后保存ssh配置文件并使用systemctl命令重新启动ssh服务

systemctl restart ssh.service

现在,您应该能够通过SSH协议使用root用户帐户访问您的debian服务器。

默认情况下已禁用debian中的ssh root登录,因为不建议通过ssh使用root密码。您通常应该做的是以普通Linux用户身份ssh到服务器,然后使用su命令以root用户身份登录。

转载来源:https://www.configserverfirewall.com/debian-linux/install-debian-ssh-server-openssh/

转载来源:https://www.configserverfirewall.com/debian-linux/enable-debian-root-ssh-login/

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值