For some special purpose, I want to prevent non-root users of the Linux Server from changing/renaming the filenames. However, they can modify and write to the contents of the file. How to do this from command line.
- This question does not appear to be about server, networking, or related infrastructure administration within the scope defined in the help center.
Revoke write privileges on the directory where this files reside. After this anyone without write privilege cannot change directory contents (like renaming files or creating new ones) but would be able to edit and save files.
> mkdir test > cd test > touch tester > chmod -w . > echo test >> tester > mv tester tester2 mv: rename tester to tester2: Permission denied