Root file system destroyed with permission script

Hi everybody,

I faced a really big problem. I cannot launch the Nextcloud installation with the web Interface. I searching on the internet for some help and I saw this tutorial with a script for permissions.

I copy the script and executed it. When the script was finished everything was corrupted, I have no shell command available. I restarted my machine and it cannot boot anymore because permission denied on /sbin/init. This is what I have :

run-init: /sbin/init: Permission denied
Target filesystem doesn't have requested /sbin/init.
run-init: /sbin/init: Permission denied
run-init: /etc/init: Permission denied
run-init: /bin/init: No such file or directory

I looking for some advice for this mess : I have tested fsck -f on /dev/sda2 but no luck (It sayed everythink is OK…).

I try to chroot on /dev/sda2 but impossible because I have a permission denied on /bin/bash

If I check the right on this bin :

_rwx-r-x-r-x root root so everything is OK.

The only thing I have found is the root folder has no right. I have modified with command : chmod +rx root/ but the OS doesn’t start either.

OS : Debian 9.7

Thanks in advance,

PS : Sorry for my English…

You should have a look at this
and this

I had a look at the permission script and I don’t see how it could corrupt your system in the way you describe.

I readed too. But this is from a Nextcloud Developper on this link :

4. The script that is there had even some bugs and once destroyed the complete root file system…

I have saw this too late unfortunatly… don’t understand either…

The only way which I can think of, that script could have ruined the whole filesystem is, when the variable “ocpath” had been changed to a bad value or changed to blank.

With ocpath='' the find command with chmod would remove all execution bits under / (root). The command chown would then change the ownership of all files and folders:


find ${ocpath}/ -type f -print0 | xargs -0 chmod 0640
find ${ocpath}/ -type d -print0 | xargs -0 chmod 0750

chown -R ${rootuser}:${htgroup} ${ocpath}/

Did you modify that variable (or forgot it), @0v3rFl0w?

Anyway, to solve your problem either try the ideas of peteman52 or start all over :frowning:

I have check again and you have right, I copy and paste but it missed the “o” for ocpath


I have seen that and recover the right of the root folder but it doesn’t work.

It’s my fault, I will restart again.

Thanks anyway for your answers :wink: