help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Edit file write protected by superuser rigths


From: Tim X
Subject: Re: Edit file write protected by superuser rigths
Date: 09 Aug 2005 18:02:12 +1000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Armin Goralczyk <address@hidden> writes:

> Hi
> How can I edit a file that is write protected by superuser rights? I
> can visit the file but it is read-only. I removed read-only
> protection by C-x C-q (toggle-read-only) but after editing I cannot
> save the file. Minibuffer says:
> File fink.conf is write-protected; try to save anyway? (yes or no) ->
> yes
> Doing chmod: operation not permitted
> 
> So how can I save the file provided that I can have superuser rights?
> 
> Thank you
> Regards
> Armin
> 

Well, first of all you need to somehow let emacs know you have
superuser rights. The obvious way to do this is start emacs while
logged in as the super user. However, this is a bad way of working. 

The easiest alternative is to use tramp and define a "sudo"
method. You will need to have sudo configured for this to work. The
idea is outlined in detail in the tramp manual (at least it use to be
last time I read it some time back). 

If you don't want to go to this extent, the other solution is to copy
the file to your home directory, edit it and then copy it back after
su'ing to root or using sudo. 

Note that I'm assuming your running under some form of unix or linux
and that your not logged in as the su when starting emacs. If you are
not running on unix/linux, then I cannot help.

Tim

-- 
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you 
really need to send mail, you should be able to work it out!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]