Thursday, May 5, 2022

[SOLVED] Are touch and chmod write operations?

Issue

If a file system is in read-only mode, will I be able to perform touch and chmod? When does an operation qualify as a read or write operation?


Solution

touch creates a zero byte file when called on a non-existent file. And it updates file's metadata based on the arguments passed. chmod does not change a file's data; it just changes the metadata contained in the file's inode.

However, the metadata itself is a part of the file system and hence it is a write operation.

In summary, both touch and chmod are write operations. They can't be run on a read-only file system.



Answered By - codeforester
Answer Checked By - Marie Seifert (WPSolving Admin)