Edit write-protected files by breaking hard links

Posted by Taymon on Super User See other posts from Super User or by Taymon
Published on 2012-09-07T12:10:19Z Indexed on 2012/09/16 15:41 UTC
Read the original article Hit count: 166

Filed under:
|

A directory which I own and can write to contains hard links to files that I don't own and don't have write permission for. I want to open and edit these files in Emacs. When I save my changes, Emacs should rename the existing hard link by appending ~, then write my new version of the file as a new file owned by me.

I was under the impression that Emacs could just do this (because of the way it does backups), but it's not working; when I save, it attempts to change the file's permissions in order to write to it (and fails because I don't own the file). How do I make this happen?

© Super User or respective owner

Related posts about linux

Related posts about emacs