# SSH测试环境配置文件 # 注意:此配置为测试环境特别设计,包含多个安全风险,仅用于测试目的 # 基本设置 Port 22 Protocol 2 HostKey /etc/ssh/ssh_host_rsa_key HostKey /etc/ssh/ssh_host_dsa_key HostKey /etc/ssh/ssh_host_ecdsa_key HostKey /etc/ssh/ssh_host_ed25519_key # 日志记录 SyslogFacility AUTH LogLevel INFO # 认证设置 - 为测试目的启用各种认证方式 LoginGraceTime 60 PermitRootLogin yes StrictModes no MaxAuthTries 6 MaxSessions 10 # 密码认证设置(为测试启用) PasswordAuthentication yes PermitEmptyPasswords yes ChallengeResponseAuthentication no # 公钥认证设置 PubkeyAuthentication yes AuthorizedKeysFile %h/.ssh/authorized_keys # 其他认证方式 KbdInteractiveAuthentication no UsePAM yes # 网络设置 X11Forwarding yes X11DisplayOffset 10 PrintMotd no PrintLastLog yes TCPKeepAlive yes # 接受环境变量 AcceptEnv LANG LC_* # SFTP子系统 Subsystem sftp /usr/lib/openssh/sftp-server # 用户特定配置 # 允许所有用户通过SSH访问 AllowUsers root root2 admin test user guest oracle mysql ftp web service postgres redis mongodb anonymous # 监听地址 ListenAddress 0.0.0.0 # 为测试目的,设置宽松的连接限制 MaxStartups 100:30:200 ClientAliveInterval 30 ClientAliveCountMax 3 # 设置不同用户的特殊权限(用于测试不同场景) Match User anonymous PermitEmptyPasswords yes PasswordAuthentication yes Match User guest ChrootDirectory /home/guest ForceCommand internal-sftp PermitTunnel no AllowAgentForwarding no AllowTcpForwarding no X11Forwarding no