Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 professional 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.

1 Answer 1

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.