配置/etc/ssh/sshd_config文件

网友投稿 1223 2023-03-14

本站部分文章、图片属于网络上可搜索到的公开信息,均用于学习和交流用途,不能代表睿象云的观点、立场或意见。我们接受网民的监督,如发现任何违法内容或侵犯了您的权益,请第一时间联系小编邮箱jiasou666@gmail.com 处理。

配置/etc/ssh/sshd_config文件

在/etc/ssh/sshd_config文件是系统范围的配置文件OpenSSH允许您设置选项,修改了后台程序的运行。该文件中包含的关键字-值对,每一个线,关键字不区分大小写。这里有最重要的关键词以顶级的安全配置sshd;的完整列表和/或特别要求的sshd(8)。

编辑sshd_config文件、VI/etc/ssh/sshd_config添加和/或改变,如有必要,下列参数:

          # This is ssh server systemwide configuration file.          Port 22          ListenAddress 192.168.1.1          HostKey /etc/ssh/ssh_host_key          ServerKeyBits 1024          LoginGraceTime 600          KeyRegenerationInterval 3600          PermitRootLogin no          IgnoreRhosts yes          IgnoreUserKnownHosts yes          StrictModes yes          X11Forwarding no          PrintMotd yes          SyslogFacility AUTH          LogLevel INFO          RhostsAuthentication no          RhostsRSAAuthentication no          RSAAuthentication yes          PasswordAuthentication yes          PermitEmptyPasswords no          AllowUsers admin
          # This is ssh server systemwide configuration file.          Port 22          ListenAddress 192.168.1.1          HostKey /etc/ssh/ssh_host_key          ServerKeyBits 1024          LoginGraceTime 600          KeyRegenerationInterval 3600          PermitRootLogin no          IgnoreRhosts yes          IgnoreUserKnownHosts yes          StrictModes yes          X11Forwarding no          PrintMotd yes          SyslogFacility AUTH          LogLevel INFO          RhostsAuthentication no          RhostsRSAAuthentication no          RSAAuthentication yes          PasswordAuthentication yes          PermitEmptyPasswords no          AllowUsers admin

# This is ssh server systemwide configuration file. Port 22 ListenAddress 192.168.1.1 HostKey /etc/ssh/ssh_host_key ServerKeyBits 1024 LoginGraceTime 600 KeyRegenerationInterval 3600 PermitRootLogin no IgnoreRhosts yes IgnoreUserKnownHosts yes StrictModes yes X11Forwarding no PrintMotd yes SyslogFacility AUTH LogLevel INFO RhostsAuthentication no RhostsRSAAuthentication no RSAAuthentication yes PasswordAuthentication yes PermitEmptyPasswords no AllowUsers admin

这通知sshd_config文件,设置为与此特定配置设置:

端口22该选项端口指定的端口号码SSH守护程序监听传入的连接。默认的端口22。listenaddress192.168.1.1该选项listenaddress指定IP接口地址的网络上的sshdaemon已绑定服务器套接字。默认的是0.0.0.0为了提高安全性,您可以仅指定所需的限制可能的地址。hostkey/etc/ssh/ssh_host_key该选项hostkey在指定位置含有所述主机私有密钥。serverkeybits1024该选项serverkeybits指定要使用多少比特的密钥服务器。这些位用于当启动守护进程,以产生其RSA密钥。logingracetime600该选项logingracetime秒后在指定的服务器的连接请求之前将要等待断开连接的情况下,如果用户没有成功登录。keyregenerationinterval3600该选项keyregenerationinterval以秒为单位指定的服务器自动再生之前应等待其密钥。这是安全特征,以防止解密会话捕获。没有PermitRootLogin该选项PermitRootLogin指定是否可以使用sshroot登录。永远不要说是的这个选项。是IgnoreRhosts该选项IgnoreRhostsrhostsshosts文件或指定是否应当不被用于验证。出于安全原因,不建议使用rhostsshosts文件或用于认证。是ignoreuserknownhosts该选项ignoreuserknownhostsSSH守护程序指定是否应该忽略该用户$家庭/.ssh/known_hostsrhostsrsaauthentication期间。strictmodes是该选项strictmodes检查是否指定SSH用户的权限在其主目录和rhosts文件方可登录。该选项必须设置为是的因为用户有时可能意外地离开其全局可写文件或目录。没有x11forwarding该选项x11forwarding指定是否X11转发应启用此服务器上。因为我们没有服务器的设置GUI安装上它,就可以关闭此选项。是printmotd该选项printmotdSSH守护程序指定应该打印的内容/etc/motd当在日志文件的用户交互。在/etc/motd该文件也称为每日消息。当。syslogfacilityAuth该选项syslogfacility当指定了功能代码使用sshd日志消息。指定的设备子系统的消息——本例中是AUTH。LogLevelinfo该选项LogLevel使用指定的级别,当日志消息sshd。信息是个不错的选择。查看联机帮助页以获取更多信息sshd的其他可能性。没有rhostsauthentication该选项rhostsauthentication指定是否可以使用sshdrhosts认证。因为认证rhosts没有安全感,你不应该使用此选项。没有rhostsrsaauthentication该选项rhostsrsaauthentication指定是否与在认证尝试rhostsRSA主机认证。是rsaauthentication该选项rsaauthentication指定是否尝试RSA认证。该选项必须设置为是的为了更好的安全会话。RSA使用公共和私人密钥对创建的SSH-keygen1utility用于认证目的。是passwordauthentication该选项passwordauthentication指定是否要使用基于密码的认证。强大的安全,这种方式必须设置为是的。没有PermitEmptyPasswords该选项PermitEmptyPasswords指定是否允许服务器登录帐户使用空密码。如果你打算使用scp工具进行自动备份到网络,您必须设置该选项,是的。allowusersadmin该选项allowusers指定和控制哪些用户可以访问SSH服务。多个用户可以被指定,以空格分隔。

上一篇:驻波告警的原因及处理方法(驻波故障处理思路)
下一篇:利用 ipset 封禁大量 IP
相关文章

 发表评论

暂时没有评论,来抢沙发吧~