cancel
Showing results for 
Search instead for 
Did you mean: 
tnishiok
Flight Engineer
Flight Engineer
  • 1,564 Views

Tips: SSH Login to Labs for CUI Preference

Jump to solution

Hi colleagues,

This pertains to the recent conversation initiated by @crixus1 about "Redhat Learning Labs". It led me to question if anyone else prefers using SSH login from their local PC to the Lab, merely favoring CLI over the Web GUI rather than due to the corporate firewall restrictions or policies as mentioned by @crixus1. I personally utilize SSH remote port forwarding for this purpose since CLI is faster than GUI, and I am sharing the method below:

Prerequisites

  • Initial Access to the Lab via Web GUI is yet necessary to establish an SSH tunnel.

  • An SSH server is operational on your local PC.

  • Your local PC has a global IP address to receive incoming SSH requests.
    • If this is not the case, a cloud computing resource like AWS EC2 can be used. It's possible to establish an EC2 instance with a global IP address to serve as an SSH bastion server, and this can be done within the free tier at no cost.

Steps

  1. As usual, start the Redhat Lab and log in to the workstation via Web GUI.

  2. From the workstation, set up an SSH connection to your local PC with remote port forwarding:

    [student@workstation ~] $ ssh -R 2222:localhost:22 your-user-id@your-local-host

    This session shall be kept connected until you finish Lab excersise.
     
  3. Open terminal on your local PC (Not via the Web GUI), and do SSH login to the Lab via the established SSH tunnel port. After this you don't need to use the Web GUI.

    Example: RH294 Lab

    [your-user-id@your-local-host ~] $ ssh -p 2222 student@localhost

    student@localhost's password:

    [student@workstation ~] $ hostname
    workstation.lab.example.com
    [student@workstation ~]$ getent hosts server{a..d}
    172.25.250.10 servera.lab.example.com
    172.25.250.11 serverb.lab.example.com
    172.25.250.12 serverc.lab.example.com
    172.25.250.13 serverd.lab.example.com

     

Labels (2)
1 Solution

Accepted Solutions
diesello
Mission Specialist
Mission Specialist
  • 984 Views

Hi @tnishiok 

Thank you, this is really handy. Having all that done I've updated my ssh config file as on the example below:

Host host1
Hostname 198.51.100.3
User user1

Host host2
Hostname localhost
Port 2222
DynamicForward 5555
User student
ProxyJump host1

Then from the second terminal we connect via ssh to host2, then configure Firefox to use a sock proxy (127.0.0.1:5555) so that we can access all web services/labs directly from our local browser.

View solution in original post

2 Replies
tnishiok
Flight Engineer
Flight Engineer
  • 1,560 Views

Since this approache still requires the initial setup via Web GUI, it cannot address the use case of @crixus1. Neverthless it proves particulary beneficial for courses that require extensive amount of typing like the Ansible course, given that the response of SSH CLI is typically faster than Web GUI. It also makes copying and pasting from and into the Lab environment considerably easier.

Since this thread is not about question I don't expect answer. But it would be great if anybody can share your BKM.

Regards,
Toshi

diesello
Mission Specialist
Mission Specialist
  • 985 Views

Hi @tnishiok 

Thank you, this is really handy. Having all that done I've updated my ssh config file as on the example below:

Host host1
Hostname 198.51.100.3
User user1

Host host2
Hostname localhost
Port 2222
DynamicForward 5555
User student
ProxyJump host1

Then from the second terminal we connect via ssh to host2, then configure Firefox to use a sock proxy (127.0.0.1:5555) so that we can access all web services/labs directly from our local browser.

Join the discussion
You must log in to join this conversation.