Start SSH in CentOS rescue mode

11,440

I tried to do same thing with CentOS 7.2 to save some files. I booted into rescue mode after inserting the DVD and open the shell.

First I configure network with nmtui than I started ssh service without getting #bash:

#sh-4.2:service sshd start

and it started. But couldn't reach my files from shell and I get bash

#sh-4.2:chroot /mnt/sysimage
#bash:cd 'myfiles'
#bash:scp /* user@IPADDRESS:/path

This worked just fine. I tried to start ssh service and it didn't work. Do it with shell.

Share:
11,440

Related videos on Youtube

John Edgar
Author by

John Edgar

Updated on September 18, 2022

Comments

  • John Edgar
    John Edgar over 1 year

    I am booted into rescue mode after inserting the DVD. OS is CentOS 6.7 64

    I've tried

    cd /mnt/sysimage
    chroot /mnt/sysimage
    service sshd restart
    

    which gave back service command not found.

    What do I do next?

    • Eric Renouf
      Eric Renouf over 8 years
      Why are you trying to do this? Could you just run /usr/sbin/sshd without the service trappings?
    • John Edgar
      John Edgar over 8 years
      Yes network is setup and pinging. There is no /usr/sbin/sshd
    • Eric Renouf
      Eric Renouf over 8 years
      That also isn't in the chroot under /mnt/sysimage?
    • John Edgar
      John Edgar over 8 years
      Correct (chara limit)
    • Eric Renouf
      Eric Renouf over 8 years
      Is that perhaps part of why you're in rescue mode? Has something bad happened to the disk so it lost /usr/sbin and other stuff?
    • John Edgar
      John Edgar over 8 years
      I'm not too sure, it's been hacked for sure but I don't know what they have done. Booting gives "PCI: Fatal: No config space access function found". Rescue mode should be able to start SSH though? or FTP, anything to get access.
    • Eric Renouf
      Eric Renouf over 8 years
    • Oldskool
      Oldskool over 8 years
      Why would you want to start SSHD in rescue mode of a machine that you know is hacked? I would copy the important files onto an USB drive, but definitely not make a compromised machine able to communicate over any network, internally or externally.
    • Andrey Kitsa
      Andrey Kitsa over 7 years
      blogs.reliablepenguin.com/2009/07/07/… You missed mount /dev/pts I am sure if you have correct ISO and linux on local disk FS it will work now.