Linux FileSysten Manipulation | Sololearn: Learn to code for FREE!

0

Linux FileSysten Manipulation

I am trying to change the file attributes of my txt file on Linux I want to make the file read only! "sudo chown root:root filename.txt" "sudo chmod 444 filename.txt" and it's perfectly working on my Linux ! but when I shared the file to the android mobile, file permissions are changing automatically! from where my file is getting permission of 'w' writing? how to prevent that ? I want my file as read only even if i share it with others.

8/5/2021 2:51:07 PM

Ratnapal Shende

3 Answers

New Answer

+7

that is an operating system thing so it won't work as you expect it to. If you set a file to read only on your Linux computer, it will know that file is read only for all its users Since your Android is not a user of that operating system, it will ignore the attributes set by the Linux computer's operating system. extra can ignore: I think this worked on windows 98 and/or xp I remember downloading files that had pre set permission attributes 🤔

+4

Well leme explain in layman terms.... consider its possible to create a read-only file that works as read only throughout every os (all other computers)... now that would cause a really big issue (say you create a virus and made it read only now suddenly no one would be able to delete it 😆) There's common myth that read only files would work across any os / any pc which is not possible .. it will be read-only only on your pc ... hope u got it 「HAPPY TO HELP」 and Martin Taylor explained this very well in lil indepth