Skip to content

Instantly share code, notes, and snippets.

@da667
Last active August 13, 2021 17:29
Show Gist options
  • Save da667/24541166284f84dfc4eb314b4aa4246b to your computer and use it in GitHub Desktop.
Save da667/24541166284f84dfc4eb314b4aa4246b to your computer and use it in GitHub Desktop.
SSH config file for Chapter 15: Routing and Remote Access for Bare-Metal hypervisors: Contains root user connection profiles
Host siem
Hostname 172.16.1.3
User ayy
Host siemroot
Hostname 172.16.1.3
User root
Host ips
HostName 172.16.1.4
User ayy
Host ipsroot
HostName 172.16.1.4
User root
Host kali
HostName 172.16.2.2
User ayy
Host kaliroot
HostName 172.16.2.2
User root
@da667
Copy link
Author

da667 commented Aug 13, 2021

This is a sample ~/.ssh/config file for students reading Building Virtual Machine Labs, specifically, chapter 15 -- Routing and Remote Access for Hosted Hypervisors. Refer to section 15.5.1.1 for more details. This SSH config file assumes that you are using the default subnet assignments (e.g. 172.16.1.0/24 and 172.16.2.0/24), key-based authentication has been enabled for both the standard and root user accounts, and that the user created during OS install for all three VMs is ayy.

If you need to adjust the IP address for the IPS, SIEM, or Kali virtual machines, modify the HostName field as necessary. Likewise modify the User field to reflect the name of the user you wish to log in as over SSH as necessary.

To install this file on Linux or OSX, run the following commands:

ls -al ~/.ssh

if the output of this command indicates that the .ssh directory doesn't exist:

mkdir ~/.ssh
chmod 700 ~/.ssh

Finally, copy this file to the .ssh directory

cp config ~/.ssh/config
chmod 600 ~/.ssh/config

Test to ensure the config file is set up properly by running the following commands:

ssh siem
ssh siemroot
ssh ips
ssh ipsroot
ssh kali
ssh kaliroot

After running each of these commands, students will be prompted for the password of the specified the non-root user on each VM. Once you enter the password, confirm you are logged on to the correct virtual machine. If students have configured key-based authentication however, either they will be logged in automatically to the requested VM, or be prompted for the passphrase to the SSH private key to continue connecting.

"I already have a ~/.ssh/config file. Wat do?"

cp ~/.ssh/config ~/.ssh/config.old
cat config >> ~/.ssh/config

These commands will back up the existing ssh config file, and append the content from the sample config file to the existing config file. if problems occur, the command cp ~/.ssh/config.old ~/.ssh/config can be used to restore the backed up ssh config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment