以下是Ubuntu SSH性能優化方法:
UseDNS no
。GSSAPIAuthentication no
。TCPKeepAlive yes
,并設置ClientAliveInterval
和ClientAliveCountMax
。curve25519-sha256@libssh.org
等高效算法。/etc/sysctl.conf
文件設置相關參數,如net.ipv4.tcp_window_scaling=1
等,然后執行sudo sysctl -p
生效。Compression yes
,或在連接時使用-C
參數。~/.ssh/authorized_keys
文件,同時在配置文件中禁用密碼認證PasswordAuthentication no
。MaxStartups
限制并發連接數,用AllowUsers
/AllowGroups
限制登錄用戶。