Skip to content

Commit 538d15f

Browse files
authored
Update docs
1 parent d9c7d88 commit 538d15f

File tree

1 file changed

+51
-12
lines changed

1 file changed

+51
-12
lines changed

README.md

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,26 +64,65 @@ Vagrant will now create and provision your new Vagrant box. (this will take some
6464
1. Open a new `cmd.exe` console *with Administrator privileges*.
6565
2. Run the command `bcdedit /set hypervisorlaunchtype off`
6666
3. Reboot
67-
68-
- Try opening VirtualBox GUI, going to Preferences, Networking, and make sure there is at least one "NAT" network.
67+
68+
- Try opening the *Oracle VM VirtualBox* Windows app, going to Preferences -> Networking, and make sure there is at least one "NAT" network.
6969

7070
- If you have networking issues getting your Vagrant box up, try turning off any anti-virus software, or anything else that might mess with your network connection.
7171

7272

7373
## Login to your Vagrant machine
74-
1. To SSH in from the Windows console, just run the `vagrant_ssh.bat` script.
75-
It will change to the correct directory and run `vagrant ssh` for you.
76-
2. You can also get the ssh connection information with command `vagrant ssh-config`, convert the IdentityFile to a PuTTY .ppk file, and use PuTTY to log in. With PuTTY you can also forward the X11 connection to run graphical apps.
7774

75+
To SSH in from the Windows console, just run the `vagrant_ssh.bat` script. It will change to the correct directory and run `vagrant ssh` for you.
7876

79-
## Create a new SSH key
80-
Vagrant creates an SSH key for you, whose path you can retrieve with the `vagrant ssh-config` command.
81-
However, it is more secure to have a password-protected key that lives only in your Vagrant box.
82-
1. Login to the Vagrant machine (see above)
83-
2. Run the following command and follow the prompts
84-
```bash
85-
$ ssh-keygen -o -t ed25519
77+
You can also get the ssh connection information with command `vagrant ssh-config`, convert the IdentityFile to a PuTTY .ppk file, and use this file as the private key to log in to the Vagrant machine.
78+
79+
With PuTTY you can also forward the X11 connection, which when combined with a windows X11 server, enables you to run graphical apps and display them natively in Windows.
80+
81+
### Use a new SSH key to connect to the Vagrant guest
82+
83+
Vagrant automatically creates an SSH key for you to connect to your Vagrant guest.
84+
You can get the path to this IdentityFile with the `vagrant ssh-config` command.
85+
However, it is more secure to have your own password-protected key.
86+
87+
#### 1. Create a new key if you don't already have one
88+
89+
If you don't already have an SSH key to use, you can generate one with the `PuTTYgen.exe` program.
90+
You can also run the command `ssh-keygen -o -t ed25519` on the Vagrant machine itself, which will create a new SSH private and public key.
91+
92+
You will need to copy the private key (`/home/vagrant/.ssh/id_ed25519`) to your host machine for your SSH client to use.
93+
If you are using PuTTY, you will need to convert this key into a PuTTY `.ppk` file, using the `PuTTYgen.exe` program.
94+
95+
#### 2. Add the new public key to the Vagrant user's authorized_keys
96+
97+
Login to the Vagrant machine.
98+
There should be a file `/home/vagrant/.ssh/authorized_keys`, which Vagrant creates to allow its default SSH key to login to this machine.
99+
100+
Open up this file with a console text editor (`vi`, `nano`, etc), remove the existing line, and replace it with your own SSH public key.
101+
Now you can only login with the SSH key that you have created.
102+
103+
#### 3. Replacing the Vagrant SSH key with your own
104+
105+
Vagrant may try to use the SSH connection to do some work on the guest, such as guest provisioning.
106+
Therefore you may need to replace the IdentityFile that Vagrant has configured with your newly-created one.
107+
108+
Just run `vagrant ssh-config` (see above) and copy your SSH private key over the file listed.
109+
If your SSH private key is a PuTTY `.ppk` file, you'll need to convert it into PEM format first (using `PuTTYgen.exe`).
110+
111+
### Troubleshooting
112+
- Sometimes the SSH settings may change, like the port on your local host that is forwarded to the guest SSH port. From a Windows command-line, run the following commands:
113+
```
114+
C:\Users\willis> SETLOCAL
115+
C:\Users\willis> SET VAGRANT_HOME=C:\files\vagrant
116+
C:\Users\willis> PUSHD C:\files\vagrant\devbox
117+
C:\files\vagrant\devbox>vagrant ssh-config
86118
```
119+
120+
Verify that the HostName, User, and Port options in your SSH client match what is on the screen.
121+
122+
If you still have trouble logging in with PuTTY, you may need to convert the IdentityFile to a PuTTY .ppk file again in case the file changed.
123+
124+
125+
87126

88127
## Set up GitHub Access
89128
1. Navigate to [Add new SSH key](https://github.com/settings/ssh/new)

0 commit comments

Comments
 (0)