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.

closed as off-topic by quanta, Jenny D, Dave M, squillman, mdpc Oct 3 '13 at 22:35

  • This question does not appear to be about server, networking, or related infrastructure administration within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.


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
  • Note that they won't be able to create new files, either; the write to tester only works because the file already exists. But this may be enough for you. – MadHatter Oct 3 '13 at 9:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.