Recovering from losing all ssh access Ubuntu 16.04

So I managed to lock myself out of my own computer.

I installed mysecureshell and didn’t realize that it disables shell access, which was my only way to control the machine.

So what did I do?

  1. Recover the root password
    1. Boot into recovery mode
      1. Restart Ubuntu and when the Grub menu comes up
      2. Select Ubuntu “Advanced options”
      3. Then select “Drop to root shell prompt”
    2. Remount /
      mount -rw -o remount /
    3. Reset password
      sudo passwd
    4. Reboot
  2. Re-enable SSH
    1. Now you should be able to ssh remotely as root.  So ssh into the machine as root and provide the password
    2. vi /etc/ssh/sftp_config
    3. under the <Default> section make sure that you have the following
      Shell                   /bin/bash
    4. Restart mysecureshell
      service mysecureshell restart

Leave a Reply

Your email address will not be published. Required fields are marked *