linux公钥私钥互联

来源:互联网 发布:java开源的cms 编辑:程序博客网 时间:2024/06/16 19:27
#生成ssh配置文件ssh root@192.168.224.131The authenticity of host '192.168.224.131 (192.168.224.131)' can't be established.RSA key fingerprint is SHA256:TV36UOt/YfJSnHokQucICAjymOh4tGiO7S7VkGsJGwk.RSA key fingerprint is MD5:7e:8f:22:97:2b:6d:bc:db:ed:e5:5d:fd:a5:ff:2f:f3.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added '192.168.224.131' (RSA) to the list of known hosts.root@192.168.224.131's password: Last login: Sat Nov 25 13:08:05 2017 from 192.168.224.1cat known_hosts 192.168.224.131 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxd7AHPak0PJYjYoW86dxJfvUT7j7DJnZIqbhegYAfVPyWejTvLsZVr8VF/xPJuaZ9+OvcF+NKoWFRPEEVooL5SyEqYohM0T7Iu0gLEq8HIzjIekIFEBVGIi2Dn2Uuyj0qwQcIa5G4e/S8/yTc/2nmU78hKLuxvBYaTpNlDDunMYBuFkkaAnfBHIwnx69c6JAwkTttcPPBTqD5VL/mzGFIXTH3uVXDb9StxUtWeBf549N3gW3SYpkkorIlMpwIdrhpbjMiIaO4StfUyDLpA/6J9Mv7LVWbz/cmEE4+/cz34VgaDl67HWy5WE3jXJpDuQw+5uJ3aMUzmtM2NsIE48UDw==#生成公私玥ssh-keygen Generating public/private rsa key pair.Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa.#私钥路径Your public key has been saved in /root/.ssh/id_rsa.pub.#公钥路径The key fingerprint is:SHA256:OEWz465L9PjLF77AlWCOYWaBqr7gIA3htDaD1pFWbjs root@liyanan_pythonThe key's randomart image is:+---[RSA 2048]----+|    o. o        ||    =  o o      ||.. = o= *        ||+.= o+.O o .    ||oO . E= S o      ||+oo  ..* ..      ||= .  o =. .    ||=.  . + .o      || o.  o.+o..    |+----[SHA256]-----+cat /root/.ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGvuLPbBoL1N+Q4ZOaQe8mrVt/dS5WyxivWf0mQ2Y1Aj3wC7SEvRdRad3z/QLDTjVTS/uDDEL3Ol/vo0UtzGVink5hw86c5YZ8ZRyUdZ56bBqi1ZOcpd4sAg0GOQ+2N1pvxikm5lv42K8JrjZhAp2mCvb+t5AcQb3XTJvIgATsBKQXCIziUC/X0FcVzXj4ouPQWtw2PMGFJlfKk/H2D5QhK86qsQXUIRrRmQ67gsV7NpkjfWKznucZxLDdhzooLHNBpzfA72r9ojvB0r1g08qmhmtngZ7/JaG6qaQ1g6l7Mts1Xlz8t4QMY1p4bPiXLdkIa8a05d2M3tG4+8opeeqv root@liyanan_python#发送公钥给对方ssh-copy-id "liyanan@192.168.224.131"/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.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: WARNING: All keys were skipped because they already exist on the remote system.        (if you think this is a mistake, you may want to use -f option)#无密码登陆[root@liyanan_python .ssh]# ssh liyanan@192.168.224.131Last login: Sat Nov 25 13:51:41 2017 from 192.168.224.129