You are not logged in.

#1 2026-04-26 16:40

bretsim
Member
Registered: 2021-11-21
Posts: 32

The stupidest mistake ever

I unzipped a folder and found some of the files had a padlock symbol showing. I searched up about how to get rid of this, and found a command

sudo chmod -vR 777 *path*/*

Unfortunately, I accidentally pressed enter after I'd deleted the placeholder path but before I'd added a path to the document, so it started changing the permissions for every file in /

When I realised what was happening I quickly shut down the terminal window.

Now even sudo won't work.

I realise this is a very amateurish error. Is there any way back short of starting again with a new install? I was hoping the unique way q4os installs alongside windows means there might be an easier way to restore functionality and security (seeing as i guess I made every file in the root accessible to anyone...) but I realise that's optimistic!

Last edited by bretsim (2026-04-26 17:06)

Offline

#2 2026-04-27 07:16

theasmitkid
Member
From: NCT of Delhi
Registered: 2025-01-26
Posts: 348

Re: The stupidest mistake ever

You could try doing a restore from timeshift, which might work


Coding & Robotics Enthusiast | Brave & Spck Editor @ Lenovo Tab 4 8 · Android 8.1 · 2GB · 16GB

Offline

#3 2026-04-27 09:28

q4osteam
Q4OS Team
Registered: 2015-12-06
Posts: 6,114
Website

Re: The stupidest mistake ever

We are afraid, the most easy way would be a fresh installation.

Offline

#4 2026-04-27 11:52

bretsim
Member
Registered: 2021-11-21
Posts: 32

Re: The stupidest mistake ever

theasmitkid wrote:

You could try doing a restore from timeshift, which might work

How does this work please?

Offline

#5 2026-04-27 11:55

bretsim
Member
Registered: 2021-11-21
Posts: 32

Re: The stupidest mistake ever

q4osteam wrote:

We are afraid, the most easy way would be a fresh installation.

I thought that might be the case. I've zipped up all my files and was planning to copy it out to the Windows filesystem, but I can't find any way to do this? On my old Q4os install (alongside Win 7) there was a shortcut on the desktop to access all the storage devices but I can't seem to find any way to get them this time? Any hints?

Offline

#6 2026-04-27 13:28

q4osteam
Q4OS Team
Registered: 2015-12-06
Posts: 6,114
Website

Re: The stupidest mistake ever

Just insert a USB flash and the storage device appears in Dolphin.

Offline

#7 2026-04-28 01:53

bretsim
Member
Registered: 2021-11-21
Posts: 32

Re: The stupidest mistake ever

q4osteam wrote:

Just insert a USB flash and the storage device appears in Dolphin.


So there's no way to access the rest of the storage in the machine?

Offline

#8 2026-04-28 02:01

bretsim
Member
Registered: 2021-11-21
Posts: 32

Re: The stupidest mistake ever

Is there no way to restore all the permissions to default? Or to copy the filesystem over from a fresh install?

I'm amazed (and quite frustrated) that a modern OS allowed something this destructive to take place on a slip of a finger without even a warning tbh.

Offline

#9 2026-04-28 07:46

hchiper
Member
From: Belgium
Registered: 2020-07-28
Posts: 790

Re: The stupidest mistake ever

bretsim wrote:
theasmitkid wrote:

You could try doing a restore from timeshift, which might work

How does this work please?

For this to be possible, you must have created a backup using Timeshift before modifying the permissions (chmod). If you don't have a backup, no restore is possible.


Q4OS machine: Samsung R519 - Pentium T4200 2.0 GHz - 4 GB RAM - 500 GB SSD

Offline

#10 2026-04-28 09:09

hchiper
Member
From: Belgium
Registered: 2020-07-28
Posts: 790

Re: The stupidest mistake ever

bretsim wrote:

Is there no way to restore all the permissions to default? Or to copy the filesystem over from a fresh install?

You could try changing the permissions back to their previous values (sudo would no longer be necessary if the affected files were granted 777 permissions), but you would then need to know which files were modified and what their original permissions were, which is probably not the case. Even if you could find them, it would likely be such a tedious task that you would probably prefer to reinstall the system completely.

I'm amazed (and quite frustrated) that a modern OS allowed something this destructive to take place on a slip of a finger without even a warning tbh.

With Linux command line, "sudo" is a warning by itself. Even if the warning were a confirmation message box with buttons, one can still slip on OK instead of Cancel...
That said, I understand your frustration very well.


Q4OS machine: Samsung R519 - Pentium T4200 2.0 GHz - 4 GB RAM - 500 GB SSD

Offline

#11 2026-04-28 15:11

seb3773
Member
From: France
Registered: 2023-11-01
Posts: 228

Re: The stupidest mistake ever

You can try to boot from a Live USB (like Debian Live or Q4Rescue) - If using a manual Live USB, you must mount the environment. If using Q4Rescue, use its built-in chroot script, but ensure the following are mounted:


mount /dev/sdXn /mnt           # the "broken" system partition
mount --bind /dev /mnt/dev
mount --bind /dev/pts /mnt/dev/pts
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
mount --bind /etc/resolv.conf /mnt/etc/resolv.conf # Essential for Internet
chroot /mnt

Then, we must be sure that apt and dpkg have the minimum required permissions to execute:


chmod 755 /usr/bin/dpkg /usr/bin/apt*
chmod 644 /etc/apt/sources.list

And then, try to reinstall every installed package (will force the system to re-apply the correct permissions and owners for all system files)


apt-get update
for pkg in $(dpkg --get-selections | awk '{print $1}'); do apt-get install --reinstall -y -o Dpkg::Options::="--force-confold" "$pkg";done

(*you will need internet connection for this to work)

Now, if this sucess, some files are not managed by apt or require specific restrictive permissions: Run these manually:

chmod 640 /etc/shadow
chmod 600 /etc/gshadow
chmod 1777 /tmp
chmod 440 /etc/sudoers
chmod 750 /etc/sudoers.d

then exit chroot and reboot. Important: I did not test this procedure *exactly* (encountered this kind of problem once a time, but not at this "level"), so I can't assure it will work, but it's worth trying.

Last edited by seb3773 (2026-04-28 16:49)


Debian & Q4OS (TDE!!), low-level C, ASM (z80/68k/x86/ARM64), embedded systems, CPU architectures (RISC-V, binary formats, assembly), retro-computing, metal music, guitar and sci-fi.

Offline

Board footer

Powered by FluxBB