0

I made a mistake in /etc/sshd_config so have locked myself out of my remotely hosted server running Centos 6.

It's running Apache and I have FTP access to /var/www and I know the root password.

To try to restore sshd_config I have tried creating a PHP page with a few exec() and passthru() commands - these run as user apache. I have tried:

echo "password" | su -c "cp -f sshd_config /etc/sshd/sshd_config"

but that didn't work. expect is not installed on the server.

Does anyone know a way of resolving this?

  • What mistake did you do in ssh_config? – tachomi Jul 28 '14 at 20:44
  • Do you have FTP or SFTP access? The title and the contents of your Q are disagreeing with each other. – slm Jul 28 '14 at 21:53
  • SFTP. The sshd_config is pointing to a hostkey file that does not exist. – bao7uo Jul 29 '14 at 9:17
2

Does root have SFTP access? Can you sftp root@remote? If so, you should be able to download the /etc/sshd/sshd_config from the remote to your local machine, fix it, and push the corrected version back.

0

Is this a server you setup, or is it something a hosting provider supplied? If the hosting provider supplied it, do they offer a method of installing Webmin?

If not, what exactly did you change in your SSH configuration?

  • Hosting provider set up. No they don't offer webmin. – bao7uo Jul 29 '14 at 9:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.