LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices


Reply
  Search this Thread
Old 04-23-2016, 04:24 PM   #1
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Rep: Reputation: 169Reputation: 169
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.
 
Old 04-23-2016, 07:59 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,311
Blog Entries: 28

Rep: Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137
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.
 
Old 04-23-2016, 08:39 PM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
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?
 
Old 04-23-2016, 09:03 PM   #4
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
Quote:
Originally Posted by frankbell View Post
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.

Last edited by Fixit7; 04-23-2016 at 09:07 PM.
 
Old 04-23-2016, 09:05 PM   #5
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
Quote:
Originally Posted by rknichols View Post
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.
 
Old 04-23-2016, 11:37 PM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
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.
 
Old 04-25-2016, 07:15 AM   #7
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
Geany does work by saving to a different file name.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Show immutable attribute Fixit7 Puppy 2 01-01-2016 07:27 PM
How do I modify 1 of my ldap attribute if I have 2 same attribute under 1 entry? chinho Programming 1 01-31-2011 03:37 AM
Linux image editors, video editors, audio editors, designing programs? vieya Linux - Software 3 12-06-2009 10:02 AM
update problem "Attribute error object has no attribute 'rsplit' ruse Linux - Newbie 0 08-28-2009 01:46 AM
ldap_add: Undefined attribute type (17) additional info: ojectclass: attribute type vinaytp Linux - Newbie 2 05-28-2009 04:57 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > General

All times are GMT -5. The time now is 06:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration