Skip to content


SSH โดยใช้ finger-print (ใส่ password อัตโนมัติ)

พอจะทำ rsync เลยต้องมาหาวิธีการใช้ ssh โดยไม่ต้องใส่ password จึงได้วิธีการใช้งานดังนี้

จาก WikiBall

ในการ login ผ่าน ssh เราสามารถใช้ fingerprint หรือลายนิ้วมืออิเล็กทรอนิกส์แทนการใช้รหัสผ่าน หรือลูกกุญแจ ซึ่งในวิธีนี้แหมาะอย่างยิ่งสำหรับการใช้สคริปต์ เช่น bash script ติดต่อผ่าน ssh เช่นการทำ rsync เป็นต้น


ใช้ลูกกุญแจแทนพาสเวริ์ด, ssh-keygen

สร้างกุญแจสำหรับเครื่อง client ที่ต้องการ login ไปที่ server ด้วย ssh-keygen

$ ssh-keygen -t dsa
Enter file in which to save the key (/home/thespn/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/thespn/.ssh/id_dsa.
Your public key has been saved in /home/thespn/.ssh/id_dsa.pu
The key fingerprint is:
e9:9f:4e:ed:da:77:35:cb:df:3f:c8:5d:b5:94:fe:c4 thespn@thespn-laptop
The key’s randomart image is:
+–[ DSA 1024]—-+
| |
| |
| .|
| . o.|
| S o.o|
| . . +E|
| . . o +.*|
| o + o.=+|
| .=.o. .B|
+—————–+

กด enter ให้หมดสำหรับใช้ค่า default (แนะนำ)


ส่ง key ไปที่ server

ส่งกุญแจไปที่ server ด้วยคำสั่ง ssh-copy-id

ssh-copy-id [-i [identity_file]] [user@]machine

พิมพ์ yes แลัวต่อไปใส่รหัสผ่าน
ซึ่งในที่นี้ indentity_file ของเราก็คือ /home/user/.ssh/id_dsa


ลองเข้าเลย

ssh machine -l user

รับข้อมูลจาก (Reference) :

จาก WikiBall : http://wiki.memoball.info/index.php/Ssh_fingerprint

Posted in Linux. Tagged with .

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.