<body id=bd><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/platform.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d7145547\x26blogName\x3dESZhang+blog\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dSILVER\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttps://zenac.blogspot.com/search\x26blogLocale\x3den_US\x26v\x3d2\x26homepageUrl\x3dhttp://zenac.blogspot.com/\x26vt\x3d3767548654419712195', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

 ESZhang blog

บันทึก ความทรงจำ บ่น ระบาย เหตุบ้านการเมือง ไปๆมาๆ กล้องกับการถ่ายรูป กับงานสุดรัก คอมพิวเตอร์งัย

OpenSSH Login ด้วย Private Key

วันนี้ลองทำ SSH แบบ Login ด้วย Private Key ดูเลยเอามาลงไว้กันลืม
  • ขั้นแรก Genkey ด้วยคำสั่ง # ssh-keygen -t dsa -N "passphrase" -C "comment" -f ~/.ssh/identity PassPhrase ไม่ใส่ก็ได้ถ้าไม่อยากให้มันถามตอนเอาไปใช้แต่จะไม่ค่อยปลอดภัย
  • เอา File ~/.ssh/identity.pub ไปใส่ใน Server ที่ต้องการ SSH เข้าไปใช้งาน # scp ~/.ssh/identity.pub username@server.com:.ssh/authorized_keys2 ตัวอย่างจะใช้เฉพาะ SSH Protocol version 2 นะครับถ้าเป็น Version 1 เอาเลข 2 ออก
  • อย่าลืมเปลี่ยน Mode ให้เฉพาะเราเท่านั้นที่อ่านได้ทั้ง 2 ไฟล์ # chmod 600 ~/.ssh/identity # chmod 600 ~/.ssh/authorized_keys2
  • ทดสอบด้วยการลอง SSH เข้าไปดู # ssh server.com ถ้าใส่ PassPhrase เอาไว้มันจะถามหาก็ใส่เข้าไป
  • โย่ ^_^
สำหรับประโยชน์หลักๆเลยก็เพิ่มความปลอดภัยให้กับระบบ SSH ขึ้นไปอีก 1 ขั้น อีกอย่างก็แฮะๆ ถ้าไม่ใส่ PassPhrase ก็ไม่ต้องใส่ Password งัย (แล้วก็ลืมประโยชน์ของข้อแรกไปซะ -_-')
Monday, October 25, 2004 at 20:25
  Post a Comment »
 

My Profile

 My name: Zena
My Home: Klongsamwa, Bangkok, Thailand

View my complete profile


Copyright © 2005 for Blogger by Blogger Templates Inc. All rights reserved.