LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   General (https://www.linuxquestions.org/questions/general-10/)
-   -   Immutable attribute is a problem for editors (https://www.linuxquestions.org/questions/general-10/immutable-attribute-is-a-problem-for-editors-4175578181/)

Fixit7 04-23-2016 04:24 PM

Immutable attribute is a problem for editors
 
I want to be able to make a file write protected so I do not accidentally write over it.

So I set the immutable attribute.

Unfortunately no editor will let me save it under a different name.

Any workaround ?

I am using Linux Puppy which is root by default.

frankbell 04-23-2016 07:59 PM

This is a shot in the dark, as I've never mucked about with the immutable attribute: Copy the contents of the file to the clipboard, open a new file in an editor, paste the contents into it, then save that file.

Alternatively, unset the immutable attribute: http://www.aboutlinux.info/2005/11/m...hich-even.html, then make a copy of the file.

rknichols 04-23-2016 08:39 PM

Which editor(s) are giving you a problem? I just tried that with gedit, vim, and emacs, and none of them had any problem with writing to a different name.

Do you perhaps not have write permission in the directory?

Fixit7 04-23-2016 09:03 PM

Quote:

Originally Posted by frankbell (Post 5535647)
This is a shot in the dark, as I've never mucked about with the immutable attribute: Copy the contents of the file to the clipboard, open a new file in an editor, paste the contents into it, then save that file.

Alternatively, unset the immutable attribute: http://www.aboutlinux.info/2005/11/m...hich-even.html, then make a copy of the file.

You should 'muck' around more with the immutable attribute.

It is quite handy as even root users can not edit or delete it. :-)

Even the "all powerful" rm cannot touch it without first removing the attribute.

Your method is a clunky workaround at best. No offense.

Fixit7 04-23-2016 09:05 PM

Quote:

Originally Posted by rknichols (Post 5535661)
Which editor(s) are giving you a problem? I just tried that with gedit, vim, and emacs, and none of them had any problem with writing to a different name.

Do you perhaps not have write permission in the directory?

Geany and Open office writer.

Slacko Puppy has root access by default.

rknichols 04-23-2016 11:37 PM

I tried geany in tahrpup-6.0.5 and had no problem reading an immutable file and writing it to a new name. I can't get Slacko Puppy 6.3.0 to run well enough in a VM to test anything (major issues with X-windows and mouse tracking).

Did you make the directory immutable too? That would prevent creating a new file there.

Fixit7 04-25-2016 07:15 AM

Geany does work by saving to a different file name.


All times are GMT -5. The time now is 07:28 PM.