Skip to content

123 [sw][linux] ssh config

keep alive

On Client Side: linux

cat >> ~/.ssh/config << 'EOF'
Host *
    TCPKeepAlive yes
    ServerAliveInterval 60
    ServerAliveCountMax 3
EOF
windows
$configContent = @"

Host *
    TCPKeepAlive yes
    ServerAliveInterval 60
    ServerAliveCountMax 3
"@
Add-Content -Path "$env:USERPROFILE\.ssh\config" -Value $configContent
Or on Server Side:
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
sudo sed -i \
  -e '/^#TCPKeepAlive/c\TCPKeepAlive yes' \
  -e '/^#ClientAliveInterval/c\ClientAliveInterval 60' \
  -e '/^#ClientAliveCountMax/c\ClientAliveCountMax 3' \
  /etc/ssh/sshd_config


Comments

konosubakonoakua · 2024-12-12T01:18:26Z

Trouble shoot

Unable to negotiate with 192.168.137.222 port 22: no matching host key type found. Their offer: ssh-rsa

Solution:

ssh -oHostKeyAlgorithms=+ssh-rsa root@192.168.137.222

konosubakonoakua · 2025-04-02T02:17:58Z

allow root

sudo sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
sudo sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config