-
Notifications
You must be signed in to change notification settings - Fork 0
SSH Password Disable
WannaDrunk edited this page Oct 30, 2021
·
3 revisions
Password เป็นช่องโหว่ความปลอดภัยหนึ่ง เรามาปิดการใช้ password ในการเข้า SSH กัน
สำหรับท่านที่มี Linux Server ต้องการปิดการใช้ password ในการเข้า SSH และต้องการให้ใช้ SSH Key เพียงอย่างเดียวในการเข้าถึง server ก่อนอื่นก็ต้อง สร้าง SSH Key ตามลิงค์บทความ แล้วจึงทำการแก้ไขการตั้งค่าใน SSH
- ต้องมั่นใจก่อนว่า เราสามารถ ssh เข้า server ได้ด้วย ssh key ก่อน และทำการ ssh เข้า server ไว้ 2 จอ (sessions) เพื่อป้องกันหากตั้งค่า ssh ผิดพลาด
- ทำการแก้ไขไฟล์ /etc/ssh/sshd_config ด้วย editor ที่ถนัด
sudo vi /etc/ssh/sshd_config- ทำการค้นหาข้อความ Password ใน sshd_config จนกว่าจะพบ
PasswordAuthentication yes
# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
- เอาเครื่องหมาย # หน้าบรรทัดออก และแก้ไข yes เป็น no
# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
#PermitEmptyPasswords no
- ทำการ reload ค่าที่ตั้งใหม่ ด้วยคำสั่ง systemctl reload
sudo systemctl reload ssh- จากนั้นทดสอบ ssh เข้าระบบมาใหม่
ความคิดเห็นคำแนะนำของท่านต่อบทความนี้ จะถูกนำมาใช้ในการพัฒนาปรับปรุงงานเขียนของผม อย่างไงก็รบกวนแสดงความเห็นคิดด้วยนะครับ
สนับสนุนการเงินได้ที่
- บัญชีกสิกรไทย 003–3–29344–5
