Sometimes the handcuffs accidentally to the chmod-R777/, this system is paralyzed ~ What should we do ?? First, you must prepare the same system as the faulty machine. for example, you can install a linux of the same version in the virtual machine to create a waynerQiu in the new system. c program, the content is as follows # include & lt; sy
Sometimes the chmod-R is 777/, and the system is paralyzed ~ What should we do ?? Let's take a look.
First, you must prepare the same system as the faulty machine. for example, you can install a linux
Create a waynerQiu. c program in the new system. the content is as follows:
|
# Include # Include Int list (const char * name, const struct stat * status, int type) {if (type = FTW_NS) return 0; printf ("% s 0% 3o \ n ", name, status-> st_mode & 07777); return 0;} int main (int argc, char * argv []) {if (argc = 1) ftw (". ", list, 1); elseftw (argv [1], list, 2); exit (0 );} |
Compile the file and export the permission information.
|
# Compile gcc waynerQiu. c-o waynerQiu.com # run and export the relevant directory permission./waynerQiu.com/> waynerQiu.txt |
Copy the exported file to the faulty machine and execute the following script.
|
#! /Bin/shif [$ #! = 1] thenecho Usage: $0 \ ExitfiPERMFILE = $ 1cat $ PERMFILE | while read LINEdoFILE = 'echo $ LINE | awk' {print $1} ''PERM = 'echo $ LINE | awk' {print $2 }' 'chmod $ PERM $ FILE # echo "chmod $ PERM $ FILE" doneecho "change perm finished! " |
You can save the script as a shell file, such as mygod. sh.
Then execute
After the program runs, restart the system to see if it has been restored?