本文记录一些登陆的操作。
简化记录
1 | ssh-keygen (一路回车) |
ssh密钥登陆Linux服务
环境:windows+git bash+mingw (注:本文命令适用于Windows和Linux系统)
服务器:Linux CentOS 7
打开git bash
,产生密钥对:
1 | ssh-keygen -t rsa -b 4096 |
出现输入项时,直接回车即可。
1 | Enter file in which to save the key (/c/Users/Late Lee/.ssh/id_rsa): // 回车 |
最后输出目录:
1 | Your identification has been saved in /c/Users/Late Lee/.ssh/id_rsa. |
进入cd /c/Users/Late\ Lee/.ssh/
目录。拷贝公钥到Linux服务器。
1 | ssh-copy-id -i id_rsa.pub root@99.69.96.66 |
输出信息:
1 | /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "id_rsa.pub" |
输入ssh root@99.69.96.66
,可以不需要密码登陆。
拷贝文件使用 scp 命令。在 Windows 系统可安装 cygwin 和 git 软件,以使用其提供的命令行。