【Azure】使用ssh创建访问Linux虚拟机
来源:互联网 发布:apk签名软件 编辑:程序博客网 时间:2024/05/16 06:58
原理:
本地用gitbash和puttygen创建私钥和公钥,在创建Linux VM时将ssh公钥上传,在PUTTY用私钥登陆连接到Linux VM。
准备:
1.Git Bash for Windows
2.PUTTYGEN.exe
3.PUTTY.exe
4.Azure订阅 (Azure Resource Manager)
步骤:
一.用Git Bash创建私钥
1.输入指令:
此例中密钥名为myPrivateKey,证书为myCert.pem
openssl.exe req -x509 -nodes -days 365 -newkey rsa:2048 \-keyout myPrivateKey.key -out myCert.pem
2.得到以下类似的提示
Generating a 2048 bit RSA private key
.......................................+++
.......................+++
writing new private key to 'myPrivateKey.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
按照提示填写一系列信息,包括国家,地区,公司及个人信息等。
3.在当前工作目录中得到了私钥和证书文件
4.运行命令:
openssl.exe rsa -pubout -in myPrivateKey.key -out myPublicKey.key
得到一个名为myPublicKey.Key的公钥文件
二.为PUTTY创建私钥
1.使用Git Bash将私钥转换为Puttygen可识别的RSA私钥。
前提:名为myPrivateKey的现有密钥
在bash上运行:
openssl rsa -in ./myPrivateKey.key -out myPrivateKey_rsa
得到名为myPrivateKey_rsa的密钥
2.使用Puttygen
点击“Flie”——“Load Private Key”
3.找到刚才生成的私钥(这里是myPrivateKey_rsa)
注意:文件筛选改为AllFile,如图
默认路径为C:用户(user):%用户名%:myPrivateKey_rsa
4.单机“打开”,弹出提示,点击确认。
5.公钥就显示在界面里
6.创建VM时,把ssh公钥复制,添加到如图的位置
7.在Puttygen保存私钥
点击“Save Private Key”,
显示一个提示,询问是否想要继续,而不输入密钥的通行短语。
点击是,如果要添加点击否。
8.输入名称得到<xxxx>.ppk文件
三.用PuTTy连接到Linux vm
1.在http://putty.in51.com/download.html下载putty
2.打开putty客户端,输入在Azure门户上创建的虚拟机的IP
3.点击connection——SSH——Auth
4.找到刚才生成的.ppk文件选择。
5.Open,输入用户名,就可以看见命令行了
- 【Azure】使用ssh创建访问Linux虚拟机
- [Azure]Azure Linux虚拟机使用SSH Key登陆
- 使用 Azure 门户创建 Linux 虚拟机
- 使用 Azure CLI 创建 Linux 虚拟机
- 使用 Azure 门户创建 Linux 虚拟机
- 使用Azure powershell 创建Azure虚拟机
- Windows Azure Virtual Machine (25) 使用SSH登录Azure Linux虚拟机
- 使用远程桌面Remote desktop访问Azure虚拟机
- 【Azure】创建负载均衡器连接Linux虚拟机
- 使用 Azure 门户创建 Windows 虚拟机
- 使用 Azure CLI 创建 Windows 虚拟机
- 使用 Azure CLI 管理 Azure 虚拟网络和 Linux 虚拟机
- Windows Azure创建虚拟机
- 解决ssh访问linux虚拟机特别慢
- [Azure]使用Powershell为ASM虚拟机创建快照
- 在Azure中创建虚拟机
- 使用Vagrant创建虚拟机并ssh进去
- 使用 PowerShell 创建 Linux 虚拟机
- 实例解析OOP程序设计七大设计原则(二)
- PHP实现页面静态化
- 关于像素PNG图片在游戏引擎缩放后出现毛边的解决方案
- 关于JAVA的类的思考
- python之路——生成器
- 【Azure】使用ssh创建访问Linux虚拟机
- Linux下的文件权限解析
- php面向对象
- H
- 接口回调
- java自动匹配路径分隔符Windows、Linux自动区分
- 讯飞语音识别和转写代码
- angular和jquery取当前点击元素各自写法
- redis分布式部署以及采用Jedis访问