Post Views: 2,697
เดี๋ยวนี้ใน Windows 10 ก็มี ssh ให้ใช้งาน แต่พอใช้กับเซิร์ฟเวอร์รุ่นเก่าๆ ก็เข้าไม่ได้ซะงั้น ไปลอง ssh ฝั่ง Linux (WSL2) ก็ให้ผลเหมือนกันคือ!!!


- ถ้าเป็นเมื่อก่อน วิ่งไปหา putty อย่างไว…. แต่ Windows อุตส่าห์ทำมาให้ใช้แล้วทั้งทีจะไม่ใช้ได้ยังไง
- สิ่งที่ต้องตรวจสอบก่อนคือ man ssh_config สำหรับ Linux ฝั่ง client ว่ารองรับ ciphers และ kexalgorithms แบบไหนรองรับหรือไม่ ส่วนฝั่ง Windows 10 จะอิงตาม OpenBSD manual ซึ่งเหมือนกับ Linux แหละ


- สร้างแฟ้ม .ssh/config โดย
- Linux ก็จะให้สร้างที่ /home/username/.ssh/
- Windows ก็อยู่ที่ C:\Users\username\.ssh
- สำหรับ error ว่า no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 ให้เพิ่มข้อความต่อไปนี้ลงในแฟ้ม .ssh/config โดย somhost.example.org เป็นชื่อและโดเมนเนมของ server เป้าหมาย
Host somehost.example.org
KexAlgorithms +diffie-hellman-group1-sha1
- สำหรับ error ว่า no matching cipher found. Their offer: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se ให้เลือกมา 1 cipher ที่ปรากฎใน error มาใส่ในแฟ้ม .ssh/config
Host somehost.example.org
Ciphers aes256-cbc
- บาง server ต้องรวมทั้งสองอย่างเช่น
Host somehost.example.org
KexAlgorithms +diffie-hellman-group1-sha1
Ciphers aes256-cbc
- ถ้าไม่อยากสร้างแฟ้ม .ssh/config สามารถสั่งผ่าน command line ได้เลยเช่น
ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 oracle@somehost.example.org
หรือ ถ้ามี error 2 อย่าง
ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -c aes256-cbc oracle@somehost.example.org
เมื่อสร้างแฟ้ม .ssh/config แล้วลอง ssh เข้าไปใหม่


- อ้างอิง
- เย่ไม่ต้องลง putty ละ
- อย่างไรก็ดี ควรรีบหาทางขยับขยายย้ายเซิร์ฟที่ยังใช้วิธีการเข้ารหัสแบบเก่า ให้เป็นรุ่นใหม่ๆ จะดีและยั่งยืนกว่า
- จบขอให้สนุก