-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #201 from nerc-project/ssh_using_host_config_file
SSH using host config file
- Loading branch information
Showing
4 changed files
with
40 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,10 +51,46 @@ sure you want to connect. Type `yes`. | |
|
||
![SSH To VM Successful](images/ssh_to_vm.png) | ||
|
||
!!! tip "Note" | ||
!!! tip "Important Note" | ||
If you haven't added your key to ssh-agent, you may need to specify the | ||
private key file, like this: `ssh -i ~/.ssh/cloud.key [email protected]` | ||
|
||
To add your private key to the `ssh-agent` you can follow the following steps: | ||
|
||
1. `eval "$(ssh-agent -s)"` | ||
|
||
Output: `Agent pid 59566` | ||
|
||
2. `ssh-add ~/.ssh/cloud.key` | ||
|
||
If your private key is password protected, you'll be prompted to enter the | ||
passphrase. | ||
|
||
3. Verify that the key has been added by running `ssh-add -l`. | ||
|
||
## SSH to the VM using SSH Config | ||
|
||
**Alternatively,** You can also configure the setting for the remote instances in | ||
your SSH configuration file (typically found in `~/.ssh/config`). The SSH configuration | ||
file might include entry for your newly launched VM like this: | ||
|
||
Host ExampleHostLabel | ||
HostName 199.94.60.66 | ||
User ubuntu | ||
IdentityFile ~/.ssh/cloud.key | ||
|
||
Here, the `Host` value can be any label you want. The `HostName` value is the | ||
**Floating IP** you have associated to your instance that you want to access, the | ||
`User` value specifies the default account username based on your base OS image | ||
used for the VM and `IdentityFile` specify the path to your **Private Key** on | ||
your local machine. With this configuration defined, you can connect to the account | ||
by simply using the Host value set as "ExampleHostLabel". You do not have to type | ||
the username, hostname, and private key each time. | ||
|
||
So, you can SSH into your host VM by running: | ||
|
||
ssh ExampleHostLabel | ||
|
||
--- | ||
|
||
## Setting a password | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters