ป้องกันไม่ให้ Session SSH หลุดระหว่างเชื่อมต่อกับ Server

wk
1 min readMar 31, 2020

--

ตัวอย่าง

สมมุติ Login เข้า Server ผ่าน Secure Shell (SSH) ด้วยคำสั่ง

$ ssh root@server.llllife.dev

ถ้าปล่อยหน้าจอค้างไว้โดยไม่พิมพ์อะไรเลย สักพัก Session จะหลุด และขึ้น Error

packet_write_wait: Connection to <IP> port 22: Broken pipe

วิธีป้องกัน

เพิ่ม Config ServerAliveInterval ในไฟล์ ~/.ssh/config บน Client เพื่อให้ SSH Client ส่งสัญญาณ Keep Alive ไปยัง Server เป็นระยะ เช่น ให้ Client ส่ง Keep Alive ทุก ๆ 30 วินาที

Host *
ServerAliveInterval 30

--

--

No responses yet