bitnami / vms

Bitnami VMs
https://bitnami.com
Other
203 stars 42 forks source link

[<Bitnami Magento AWS>] I lost Sudo while trying to fix permissions #1405

Closed rukcus closed 4 months ago

rukcus commented 5 months ago

Platform

AWS

bndiagnostic ID know more about bndiagnostic ID

I can't run SUDO to get this

bndiagnostic output

I can't run SUDO

bndiagnostic was not useful. Could you please tell us why?

I can't run SUDO

Describe your issue as much as you can

While trying to fix permissions on my bitnami Magento 2 installation I accidentally ran this command and now I lost sudo

sudo chown daemon:daemon -R /

Now I am getting this error: bitnami@ip-172-31-34-120:~/stack/scripts$ sudo sudo: /etc/sudo.conf is owned by uid 1, should be 0 sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

Is there a resource anyone can point me to to get sudo back?

I tried using su but the default bitnami password of passwd doesn't work.

rukcus commented 5 months ago

When I try to run

chown: changing ownership of '/etc/sudo.conf': Operation not permitted

rukcus commented 5 months ago

I still have an ssh terminal open but I'd lost the ability to connect to ftp.

rukcus commented 5 months ago

ls -l /usr/bin/sudo

daemon owns sudo

-rwxr-xr-x 1 daemon daemon 182600 Jan 14 2023 /usr/bin/sudo

gongomgra commented 5 months ago

Hi @rukcus,

Thanks for using Bitnami. I'm afraid it is not possible to update the filesystem permissions in your current server. You would need to mount the disk into another instance as a secondary disk, connect to that instance, mount the broken filesystem in a well-known directory, and finally fix the filesystem from there. Unfortunately, we can't provide you with help on this. You will need to find help in a more specialized forum.

We recommend you to start a new instance and migrate the application data if possible, but I'm afraid I don't know if you would be able to backup your current application data due to your current instance status.

rukcus commented 5 months ago

If I were able to mount it as a second drive would it be a matter of just fixing Sudo with the correct owner or is it many different ownerships for different files?

On Wed, Feb 14, 2024, 7:19 a.m. Gonzalo Gómez Gracia < @.***> wrote:

Hi @rukcus https://github.com/rukcus,

Thanks for using Bitnami. I'm afraid it is not possible to update the filesystem permissions in your current server. You would need to mount the disk into another instance as a secondary disk, connect to that instance, mount the broken filesystem in a well-known directory, and finally fix the filesystem from there. Unfortunately, we can't provide you with help on this. You will need to find help in a more specialized forum.

We recommend you to start a new instance and migrate the application data if possible, but I'm afraid I don't know if you would be able to backup your current application data due to your current instance status.

— Reply to this email directly, view it on GitHub https://github.com/bitnami/vms/issues/1405#issuecomment-1943660236, or unsubscribe https://github.com/notifications/unsubscribe-auth/BGDFYL5DMXAJY4QIK7WKMLDYTSTTZAVCNFSM6AAAAABDE6F3UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBTGY3DAMRTGY . You are receiving this because you were mentioned.Message ID: @.***>

gongomgra commented 5 months ago

Hi @rukcus,

I guess the wrong chown command changes many other files and directories in your filesystem (probably the whole filesystem) so I don't think fixing the sudo binary would be enough.

github-actions[bot] commented 5 months ago

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

github-actions[bot] commented 4 months ago

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.