我目前有一个学校项目,我必须使用
vagrant
和 virtual box
启动虚拟机。它要求我使用 Putty
,这在 mac 中使用 terminal
本身几乎是可以避免的。但是,我到了应该使用Puttygen
的地步。确切的说明是:
13. Download PuTTYgen and open it.
14. Click on File -> Load Private Key
The file we are looking for is in the ~\trusty64\.vagrant\machines\default\virtualbox folder (which was automatically created when you installed and configured Vagrant).
Change the visibility to “All Files” and select private_key
Click OK, on the following success message.
15. Click “Save Private Key”, then click Yes in the pop-up window.
16. Save it in any directory for example ~/lucid32. Give it the following name: putty_key
现在的问题是
PuttyGen
上没有OSX
。 这个问题解决了这个问题。
首先,我使用位于文件本身的私钥进行了
ssh
,方法是调用ssh -i private_key [email protected] -p 2222
:
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-129-generic x86_64)
* Documentation: https://help.ubuntu.com/
System information as of Fri Sep 1 21:32:23 UTC 2017
System load: 0.0 Processes: 74
Usage of /: 3.6% of 39.34GB Users logged in: 0
Memory usage: 25% IP address for eth0: 10.0.2.15
Swap usage: 0%
Graph this data and manage this system at:
https://landscape.canonical.com/
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
0 packages can be updated.
0 updates are security updates.
New release '16.04.3 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
Last login: Fri Sep 1 21:32:23 2017 from 10.0.2.2
我不确定这是否有效。如何保存私钥?所以我继续尝试
puttygen privatekey -O private-openssh -o privatekey.pem
我得到了:
puttygen: unable to load file `privatekey': unable to open file
我应该在这里做什么?
尝试在终端输入
puttygen .vagrant/machines/default/virtualbox/private_key -o putty_key
来保存私钥。
访问https://github.com/ibasloom/key
在 Mac 键盘上按 Command + 空格键(或者按 F4)输入“Terminal”
brew install putty
或
sudo port install putty
puttygen ichaush3.pem -o ichaush3.ppk
-o小
尝试登录,如果不起作用,请按照以下步骤更改文件权限
chmod go-rw privatekey.pem
chmod 400 <private-key-filename>.pem