SystemRescue is a bootable Live CD based on Gentoo Linux, designed for administration as well as system and data recovery after a crash. Includes many Linux programs and tools.
Initially, file permissions are specified as follows
root@kvmde54-19861:~# ls -la
total 56
drwx------ 6 root 4096 Nov 18 15:42 .
drwxr-xr-x 23 root 4096 May 24 16:45 .
-rw------- 1 root 1 Nov 18 15:42 .bash_history
-rw-r--r-- 1 root 3106 Apr 9 2018 .bashrc
drwx------ 2 root 4096 Nov 18 15:42 .cache
drwx------ 3 root 4096 May 27, 2018 .gnupg
drwxr-xr-x 3 root 4096 May 27, 2018 .local
-rw-r--r-- 1 root 148 Aug 17 2015 .profile
-rw------- 1 root 1024 Jan 26 2019 .rnd
-rw-r--r-- 1 root 72 Jan 26 2019 .selected_editor
drwxr-xr-x 2 root 4096 Nov 18 15:42 .ssh
-rw------- 1 root 1876 May 27 13:10 .viminfo
-rw-r--r-- 1 root 180 Nov 18 15:42 .wget-hsts
-rw-r-r--r-- 1 root 1 Nov 18 15:42 ubuntu-echo
After changing permissions, which is GREATLY not recommended, you will get an output like this:
root@kvmde54-19861:~# ls -la
total 56
drwxrwxrwx 6 root 4096 Nov 18 15:42 .
drwxrwxrwx 23 root 4096 May 24 16:45 .
-rwxrwxrwx 1 root 1 Nov 18 15:42 .bash_history
-rwxrwxrwx 1 root 3106 Apr 9 2018 .bashrc
drwxrwxrwx 2 root 4096 Nov 18 15:42 .cache
drwxrwxrwx 3 root 4096 May 27, 2018 .gnupg
drwxrwxrwx 3 root 4096 May 27, 2018 .local
-rwxrwxrwx 1 root 148 Aug 17 2015 .profile
-rwxrwxrwx 1 root 1024 Jan 26 2019 .rnd
-rwxrwxrwx 1 root 72 Jan 26 2019 .selected_editor
drwxrwxrwx 2 root 4096 Nov 18 15:42 .ssh
-rwxrwxrwx 1 root 1876 May 27 13:10 .viminfo
-rwxrwxrwx 1 root 180 Nov 18 15:42 .wget-hsts
-rwxrwxrwx 1 root 1 Nov 18 15:42 ubuntu-echo
To begin the restore process, create a SystemRescueCD image using Settings - Mounting ISO
To work with the image let's go to Console
When you move through menu items, contextual help related to that item is shown at the bottom of the window.
By default, clicking ENTER in this menu will load the rescue64 kernel for 64-bit systems.
SystemRescueCD is running, let's see what partitions the system has and mount the right one.
The server drive in the system will appear as /dev/vda, you can see all the partitions with the command:
fdisk -l
In the screenshot you can see that there is 1 partition, you can mount the first partition of the Linux system with the command:
mount -t ext4 -rw /dev/vda1 /mnt/
Let's go to the folder.
cd /mnt
Create a script.
echo '
chmod -R 755 /mnt/bin /mnt/boot /mnt/dev /mnt/etc/ /mnt/home /mnt/lib /mnt/lib64 /mnt/media /mnt/mnt/ /mnt/opt /mnt/run /mnt/sbin /mnt/srv /mnt/usr /mnt/var
chmod -R 777 /mnt/initrd.img /mnt/vmlinuz
chmod -R 1777 /mnt/tmp
chmod -R 555 /mnt/sys
chmod -R 555 /mnt/proc
chmod -R 700 /mnt/root
' > fixpermission
Enable the ability to run it
chmod +x fixpermission
Run the script and see that the rights have been changed.
./fixpermission
Before:
After:
Enter the following command to resume SSH access after unmounting the system:
find /mnt//etc/ssh/ -type f -exec chmod 0600 {} \;
Next, unmount the ISO image.
You will then have a working system for further operations.
root@kvmde54-19861:~# ls -la
total 56
drwx------ 6 root 4096 Nov 18 16:53 .
drwxrwxrwx 23 root 4096 Nov 18 17:47 .
-rwx------ 1 root 23 Nov 18 17:35 .bash_history
-rwx------ 1 root 3106 Apr 9 2018 .bashrc
drwx------ 2 root 4096 Nov 18 16:53 .cache
drwx------ 3 root 4096 May 27, 2018 .gnupg
drwx------ 3 root 4096 May 27 2018 .local
-rwx------ 1 root 148 Aug 17 2015 .profile
-rwx------ 1 root 1024 Jan 26 2019 .rnd
-rwx------ 1 root 72 Jan 26 2019 .selected_editor
drwx------ 2 root 4096 Nov 18 16:53 .ssh
-rwx------ 1 root 1876 May 27 13:10 .viminfo
-rwx------ 1 root 180 Nov 18 16:53 .wget-hsts
-rwx------ 1 root 1 Nov 18 16:53 ubuntu-echo
Please be advised that this guide does not guarantee a full system restore after recursively changing file permissions and we STRONGLY recommend that you do not use the chmod -R 777 / command on your server.
If you have configuration difficulties or further questions, you can always contact our support team via [ticket system] (https://fornex.com/my/tickets/).