在windows下生成ssh公钥 您所在的位置:网站首页 windows查看ssh公钥 在windows下生成ssh公钥

在windows下生成ssh公钥

2023-09-20 05:16| 来源: 网络整理| 查看: 265

windows系统下的cmd命令行是不能直接使用ssh命令的。

为了利用ssh命令生成公钥-私钥对、访问远程Linux服务器等,必须先安装一下工具:

windows下cmd中使用ssh命令访问Linux服务器的工具

随后打开cmd,在其中使用:

ssh-keygen -t rsa

生成公钥-私钥对

举例:

C:\Users\你的用户名>ssh-keygen -t rsa -b 2048 【上面一行的-t参数代表类型type,表示用rsa方式加密;-b参数,这里表示生成2048位的公钥】 【输完ssh-keygen -t rsa -b 2048后回车,生成公钥-私钥对总共只用到这一个命令,以下是配置部分】 Generating public/private rsa key pair. Enter file in which to save the key (/cygdrive/c/Users/你的用户名/.ssh/id_rsa): 【在上一行的冒号后输入保存私钥的文件名。默认是在C:\Users\你的用户名\.ssh\ 这个路径下,生成名为id_rsa的文件。】 【另外在该路径下还会自动生成id_rsa.pub文件,用来保存公钥。】 Enter passphrase (empty for no passphrase):【在这里输入私钥密码】 Enter same passphrase again:【重复输入私钥密码】 Your identification has been saved in c/Users/你的用户名/.ssh/id_rsa. Your public key has been saved in c/Users/你的用户名/.ssh/id_rsa.pub. 【上面两行说明了你私钥、公钥的保存位置】 The key fingerprint is: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

生成成功后,将id_rsa.pub文件发给Linux远程服务器管理员,让他为你创建用户,并将用户名告诉你(你们可以约定一个登陆用户名)。随后在pycharm/xshell/cmd上就可以用私钥进行登陆访问了。

依次打开tools->deployment->configuration

点击左上角+号add server

name自取,type选择SFTP

按下图依次进行配置即可:

可以使用右上方的test SFTP connection按钮测试连接



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有