I created user accounts on my linux server, then I disabled password logins. I configured ssh to not accept password logins and only accept ssh. I configured the ufw firewall and forgot to allow ssh port. So now I cannot login as no incoming connections are accepted, is there any thing I can do to reset this? The OS running is Ubuntu 14.04 LTS release and it is running inside a VirtualBox vm.
Recovery is similar to a lost root password (and might be easiest).
connect to the console of your VM, using virtual box.
a. if you can log from there, log as user, then sudo root, then edit sshd (and firewall rules) and reboot.
b. if you can't log, neither root/nor user, reboot hosts, upon boot, select kernel (using arrows), edit (using e), then add
init=/bin/bashto kernel line.
/usr, then edit
mount -o remount,rw / mount /usr vi /etc/ssh/sshd_config vi /etc/passwd # see bellow vi /fire/wall/rules # (sic) reboot
lost root password ?
to recover a lost root password, once you are in step 3.
vi /etc/shadow, edit line like
$6$...up to but not including
:(this will allow login with no password).
$ sudo ufw allow ssh/tcp $ sudo ufw logging on $ sudo ufw enable $ sudo ufw status
If this does not help go to
sshd: ALLOW: ALL and restart the sshd, disable the firewall before restarting the sshd