Home >Operation and Maintenance >Linux Operation and Maintenance >How to restore read-only files in Linux
Linux file read-only recovery method: 1. Use the "chmod 666 specified file" command to set the read-only file to a read-only and writable file; 2. Use the "chmod 222 specified file" command to set the read-only file to a read-only file. The file is set to be writable but not readable.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
First we open the operating system.
Find the terminal window in the menu bar and click to enter.
We create a new file as an example and set it as a read-only file.
If a read-only file is opened, read-only will be displayed.
chmod 666 test.txt. At this time, execute the command. The test file is test.txt. 666 means to change it to a readable and writable file.
No prompt will be displayed when opening the file at this time. Belongs to normal mode.
chmod 222 test.txt is a file that is made writable but unreadable.
#When you open the file at this time, you will be reminded that it cannot be opened because it is not readable.
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to restore read-only files in Linux. For more information, please follow other related articles on the PHP Chinese website!