How to enable SSH Service and configure network in the rescue mode?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 9
  • Red Hat Enterprise Linux 10

Issue

  • How to enable SSH Service when the system is in Rescue mode?
  • How to enable SSH Service when booting with ISO in rescue mode?

Resolution

  • Get to the Rescue Mode shell:

       In RHEL 7
       sh-4.2#
    
       In RHEL 8
       sh-4.4#
    
       In RHEL 9
       bash-5.1#
    
       In RHEL 10
       bash-5.2#
    
  • Enable the network in rescue mode outside the chroot environment

  • Configuring and Starting sshd service

    • Locate the ssh_config file

      # find / -name "*sshd_config*"
      /etc/ssh/sshd_config.anaconda
      
    • Create a new sshd_config file.

      # cp /etc/ssh/sshd_config.anaconda /etc/ssh/sshd_config
      
    • Start the SSH daemon:

      # systemctl start sshd
      
  • Alternate Method.

Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.