Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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.

up vote 3 down vote accepted

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
share|improve this answer
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
Thanks @MadHatter. – kworr Oct 3 '13 at 12:49

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