生成秘鑰
$ ssh-keygen.exe Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/17982/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /c/Users/17982/.ssh/id_rsa. Your public key has been saved in /c/Users/17982/.ssh/id_rsa.pub. The key fingerprint is: SHA256:sNyM89sJWZx/wsdoa6aJYHM5ySAyEEagW0L4 1782@DESKTOP-4FR0RKP The key's randomart image is: +---[RSA 3072]----+ |==o . oo | |.o.. o.+. | |+.* o.= | |o=.= +.B | |+ o.o B.S | |o+E= o+= + | |..o.*= + o | | . o. . | | | +----[SHA256]-----+
將公鑰上傳到服務器
$ ssh-copy-id [email protected] /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/c/Users/17982/.ssh/id_rsa.pub" /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys [email protected]'s password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh '[email protected]'" and check to make sure that only the key(s) you wanted were added.
注意:上傳給哪個用戶,哪個用戶才可以免密
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/98133.html
標籤:Linux
下一篇:buffer和cache簡介
