0

Soo I was playing with firewalld on my ubuntu server instance (Oracle Cloud) and I forgot to add rule for ssh Port so I can't connect to it

I tried using serial console becouse OCI lets you connect to it from their website, but it asked for a password, except I don't have any password because I use keys. I heard that you can bypass that somehow and set a password but I don't know exactly how to do it.

4
  • 1
    I don't have any password because I use keys you DO have a password, you've just forgotten it :p Nov 28, 2023 at 8:23
  • @JaromandaX Or they were never given the password. I maintain servers that work that way. I set up the account, I set a random secure password that is never recorded or remembered, and I enable access via SSH keys.
    – Kusalananda
    Nov 28, 2023 at 8:38
  • @Kusalananda - thankfully none of the VPS providers I use have ever done that Nov 28, 2023 at 8:44
  • @JaromandaX i was never given one
    – Im-CatDev
    Nov 28, 2023 at 12:38

1 Answer 1

2

With physical servers, the usual "lost root password" procedure is to use kernel boot parameters (e.g. init=/bin/bash) to force the server into a root shell, but with cloud instances, that might not be easily doable.

Instead, it might be more convenient to stop the cloud server instance, then detach its virtual system disk from that instance and add it as a secondary disk to another, working instance, and then use that instance to fix any problems that prevent the server from booting or you from accessing it with root privileges.

5
  • OCI provides ssh access to serial. Can I utilise it in any way? I heard that you click some keys when it is booting
    – Im-CatDev
    Nov 28, 2023 at 12:41
  • Can you see the GRUB menu over the serial when the system is booting? Or any prompts at all before the Linux login prompt?
    – telcoM
    Nov 28, 2023 at 12:44
  • I get these linux kernel startup things, for example: [ 6.810949] systemd[1]: Condition check resulted in File System Check on Root Device being skipped. [ 6.831246] systemd[1]: Starting Load Kernel Modules... [ 6.853964] pstore: Using crash dump compression: deflate [ 6.862197] pstore: Registered efi as persistent store backend [ 6.872006] systemd[1]: Starting Remount Root and Kernel File Systems... [ 6.888567] systemd[1]: Starting Coldplug All udev Devices... [ 6.906331] systemd[1]: Started Journal Service. @telcoM
    – Im-CatDev
    Nov 28, 2023 at 16:43
  • So, clearly the kernel has been configured to use the virtual serial port as a console device. But unless you can interrupt the bootloader through the serial port to specify boot options, it will not help. If GRUB is configured to use a serial port, even as an alternative, it should send a message telling you to press any key to access the GRUB menu. Unfortunately it does not look like that is happening - maybe because GRUB is not configured to use the serial port, or maybe because the cloud instances are actually booted in some other way.
    – telcoM
    Nov 28, 2023 at 17:05
  • I think i will ask them on their forum. Thanks for your help.
    – Im-CatDev
    Nov 28, 2023 at 18:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .