เพิ่มความปลอดภัย SSH บน Cisco SG300 ด้วย Public Key Authentication แทน Username/Password เพียงอย่างเดียว สามารถรวมใช้ทั้งสองวิธีได้
1. เปิดใช้งาน SSH User Authentication by Public Key
Web GUI → Security → SSH Server → SSH User Authentication → ติก Enable SSH User Authentication by Public Key → Apply
2. สร้าง Key Pair ด้วย PuTTYgen
- เปิด PuTTYgen → Generate → เคลื่อนเมาส์จนครบ
- ตั้ง Passphrase (รหัสผ่านปลดล็อก Key) → Save public key และ Save private key (.ppk) → เก็บไว้ที่ปลอดภัย (แนะนำ VeraCrypt)
3. เพิ่ม User และ Public Key ใน Switch
Administration → User Accounts (ดู User ที่มีอยู่) → กลับไป SSH User Authentication → Add SSH User
- User เดียวกับ Admin: ติก Automatic Login → Login ครั้งเดียวด้วย Passphrase ของ Private Key
- User ต่างจาก Admin: ไม่ติก Automatic Login → Login 2 ครั้ง (Key แล้วค่อย User/Pass ปกติ) → ปลอดภัยกว่า
Key Type: RSA → วาง Public Key ที่คัดลอกมาจากไฟล์ .pub → Apply
4. Login ด้วย Private Key ใน PuTTY
- PuTTY → Host Name: IP Switch → Connection → SSH → Auth → Browse เลือก Private Key (.ppk)
- Open → Login as: User ที่เพิ่งสร้าง → ใส่ Passphrase
- หากเปิด Automatic Login จะเข้าสู่ CLI ทันทีหลังใส่ Passphrase