Debian系统自带sshd解决不支持账号密码认证和自动断开问题

Debian10.2系统自带sshd解决不支持账号密码认证和自动断开问题

sed -i ‘s/PermitRootLogin no/PermitRootLogin yes/g’ /etc/ssh/sshd_config
sed -i ‘s/PasswordAuthentication no/PasswordAuthentication yes/g’ /etc/ssh/sshd_config
service ssh restart

Debian 10

或10.3
sed -i ‘s/#PermitRootLogin prohibit-password/PermitRootLogin yes/g’ /etc/ssh/sshd_config
sed -i ‘s/#PasswordAuthentication yes/PasswordAuthentication yes/g’ /etc/ssh/sshd_config

 

service ssh restart #SSH重启
———————————————

debian10.2系统自带的ssh服务,在实际使用的时候,出现如下两个问题:

①账号密码方式不支持;

②客户端使用SecureCRT连接Debian的sshd后,无操作过一会会自己断开。

vim /etc/ssh/sshd_config
我修改如下几处内容:

PasswordAuthentication yes
TCPKeepAlive yes
ClientAliveCountMax 360
其中PasswordAuthentication是让sshd支持账号密码形式的认证。TCPKeepAlive是sshd和客户端有保活机制。ClientAliveCountMax指的是如果客户端这些次都没有相应,就关闭连接。

SSH服务:

[Unit]
Description=OpenBSD Secure Shell server
Documentation=man:sshd(8) man:sshd_config(5)
After=network.target auditd.service
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run

[Service]
EnvironmentFile=-/etc/default/ssh
ExecStartPre=/usr/sbin/sshd -t
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
ExecReload=/usr/sbin/sshd -t
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=notify
RuntimeDirectory=sshd
RuntimeDirectoryMode=0755

[Install]
WantedBy=multi-user.target
Alias=sshd.service

————————————————
版权声明:本文为CSDN博主「黑色之光_duan」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/microsko/article/details/104270002