dimitriz's picture

Hello,

I just recently started a new job and just ran across a system running in our internal environment with Drupal 8.

I am able to login as an admin to the website to manage content and do limited updates?

Drupal core is 8.7.8

PHP 7.0.33

so about a year outdated.

Of course nobody has any passwords to get into Adminier nor SSH/SFTP.

TKLBAM is not initialized either.

What are my options besides setting up a new box from scratch and manually copying all the content for the entire organization.

 

Thank you.

 

 

 

 

Forum: 
Jeremy Davis's picture

How you approach this will depend on how much work you want to do now and how much you want to defer to later.

When you say that you don't have SSH/SFTP access, do you have terminal access via the 'root' user? Or only access to Drupal? (I'll assume that latter). Also is this server running on bare metal? Or is it a VM of some sort? If so, what virtualisation is it using?

Regardless, to move forward, you will need SSH or terminal access. By default, the root user account has a password set and should also allow login via SSH/SFTP.

If you don't have terminal and/or SSH access, then depending on how/where this server is running, you should be able to reboot the server from a "Live CD/ISO" of some sort (some sort of Linux ISO which can boot from ISO/CD/USB into memory, rather than from the HDD). You can then mount the root volume of your Drupal 8 appliance, chroot into it and change the root password (via the passwd command).

I won't delve into the details of that here. Partially because without knowing the exact details of your server (e.g. whether it is installed with LVM or not) my notes would need to be exhaustive. And partially because it's relatively generic info that should be fairly easy to find online - especially if you keep in mind that it sounds like you are running a v15.x appliance; which is based on Debian 9/Stretch. In essence any Linux Live CD/USB/ISO should do the trick and once you have the root volume mounted, and logged into the chroot you should be able to reset the root user via the command: 'passwd root'.

Once you have root access, then you should be able to update Drupal without needing to update the base OS (and by default TurnKey installs PHP from Debian repos). As I mentioned, TurnKey v15.x is based on 9/Stretch which will get LTS security updates until mid 2022. So while Drupal still works ok with PHP7.0, there isn't really any need to update to a newer OS and/or PHP.

dimitriz's picture

Tanks Jeremy,

The Drupal is running in a VMWare environment. I would assume that whoever set it up used vmdk downloaded image.

I do not have any SSH/SFTP access to the box.

I Cloned the VM and booted from Ubuntu 20.04 Live CD.

In File Manager it shows the Drupal as an 18GB volume /dev/dm-0

In Terminal I see it under /media/ubuntu/4338a88c-XXXX-XXXX-XXXX-XXXXXXXXXXX folder

Not really a Linux expert but trying to find more instructions on how to use chroot etc...

 

Thanks

 

 

 

Jeremy Davis's picture

Yep the Ubuntu live disk should do the job, but you'll need to install LVM by the sounds so will need networking setup in Ubuntu. Try this (assuming root, most of these commands probably require sudo if not root):

First install LVM:

apt update
apt install lvm2

Then scan and load VG (volume groups):

vgscan
vgchange -ay

That should load the TurnKey VG. It's most likely called "turnkey", but just in case I'll show the expected output (with 'turnkey") so you can adjust to as needed.

root@core ~# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "turnkey" using metadata type lvm2
root@core ~# vgchange -ay
  2 logical volume(s) in volume group "turnkey" now active

So assuming that you have a "turnkey" (or similar) volume group, then the root volume will be /dev/turnkey/root so you can mount it like you would any other "device", chroot in, change the root password, and back out again. I.e.:

mkdir /media/drupal-app
mount /dev/turnkey/root /media/drupal-app
chroot /media/drupal-app
passwd root
exit
umount /dev/turnkey/root
poweroff

And now you should be good to reboot your TurnKey appliance and log in via SSH using your shiny new root password! :)

dimitriz's picture

Got it after few hours of messing around. :)

Just gotta swap the VMs around and start resetting some of the other passwords.

Thanks!

Jeremy Davis's picture

Sorry I missed this post...

Anyway, I'll leave my post there as it may be useful for others. It sounds like you got it so good work! :)

dimitriz's picture

Not a problem. I am actually glad you replied because you definitely added more things and detail that can be used by others in a similar situation.

I also wanted to add that I used the following guide to help me:

https://dzone.com/articles/uncommon-usages-of-chroot-password-resetting

 

 

Add new comment