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.
Asked
Active
Viewed 873 times
1 Answers
3
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

kworr
- 1,055
- 8
- 14
-
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 03 '13 at 09:25