all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Edit file write protected by superuser rigths
@ 2005-08-08 20:47 Armin Goralczyk
  2005-08-08 21:35 ` Peter Dyballa
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Armin Goralczyk @ 2005-08-08 20:47 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Edit file write protected by superuser rigths
  2005-08-08 20:47 Edit file write protected by superuser rigths Armin Goralczyk
@ 2005-08-08 21:35 ` Peter Dyballa
  2005-08-09 17:58   ` Armin Goralczyk
       [not found] ` <mailman.3062.1123538567.20277.help-gnu-emacs@gnu.org>
  2005-08-08 22:47 ` Sebastian Luque
  2 siblings, 1 reply; 10+ messages in thread
From: Peter Dyballa @ 2005-08-08 21:35 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 08.08.2005 um 22:47 schrieb Armin Goralczyk:

> So how can I save the file provided that I can have superuser rights?
>

Use 'sudo chmod ... <the directory>' or 'sudo chown ... <the 
directory>' that you're allowed afterwards to save a file in that 
directory.

Or save it to your home directory and move it afterwards as root/with 
sudo.

--
Mit friedvollen Grüßen

   Pete

Know thyself.  Need help, call CIA.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Edit file write protected by superuser rigths
       [not found] ` <mailman.3062.1123538567.20277.help-gnu-emacs@gnu.org>
@ 2005-08-08 22:02   ` William Daffer
  0 siblings, 0 replies; 10+ messages in thread
From: William Daffer @ 2005-08-08 22:02 UTC (permalink / raw)


Peter Dyballa <Peter_Dyballa@Web.DE> writes:

> Am 08.08.2005 um 22:47 schrieb Armin Goralczyk:
> 
> > So how can I save the file provided that I can have superuser rights?
> >
> 
> Use 'sudo chmod ... <the directory>' or 'sudo chown ... <the
> directory>' that you're allowed afterwards to save a file in that
> directory.
> 
> Or save it to your home directory and move it afterwards as root/with
> sudo.

  Why not 'sudo emacs file'?

whd
-- 
IMBECILITY, n.  A kind of divine inspiration, or sacred fire affecting 
censorious critics of this dictionary.
	-- Ambrose Bierce: _The Devil's Dictionary_

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Edit file write protected by superuser rigths
  2005-08-08 20:47 Edit file write protected by superuser rigths Armin Goralczyk
  2005-08-08 21:35 ` Peter Dyballa
       [not found] ` <mailman.3062.1123538567.20277.help-gnu-emacs@gnu.org>
@ 2005-08-08 22:47 ` Sebastian Luque
  2 siblings, 0 replies; 10+ messages in thread
From: Sebastian Luque @ 2005-08-08 22:47 UTC (permalink / raw)


Armin Goralczyk <agoralczyk@gmail.com> wrote:

[...]

> So how can I save the file provided that I can have superuser rights?

You can use the tramp package for this. Once properly installed and
available in your session, you can do 'C-x C-f /su::/path/to/file',
provide your superuser password, and you'll be editing the file as
superuser thereafter. Watch out for a nasty bug that bit me with kernel
2.6.10 (http://thread.gmane.org/gmane.emacs.devel/37967).


-- 
Sebastian P. Luque

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Edit file write protected by superuser rigths
       [not found] <mailman.3054.1123534713.20277.help-gnu-emacs@gnu.org>
@ 2005-08-09  8:02 ` Tim X
  0 siblings, 0 replies; 10+ messages in thread
From: Tim X @ 2005-08-09  8:02 UTC (permalink / raw)


Armin Goralczyk <agoralczyk@gmail.com> 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!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Edit file write protected by superuser rigths
  2005-08-08 21:35 ` Peter Dyballa
@ 2005-08-09 17:58   ` Armin Goralczyk
  2005-08-09 18:31     ` Peter Dyballa
       [not found]     ` <mailman.3145.1123612751.20277.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 10+ messages in thread
From: Armin Goralczyk @ 2005-08-09 17:58 UTC (permalink / raw)


Thank you all for the help. I work on Mac OS X, so all suggestions  
are viable.

Am 08.08.2005 um 23:35 schrieb Peter Dyballa:

>
> Am 08.08.2005 um 22:47 schrieb Armin Goralczyk:
>
>
>> So how can I save the file provided that I can have superuser rights?
>>
>>
>
> Use 'sudo chmod ... <the directory>' or 'sudo chown ... <the  
> directory>' that you're allowed afterwards to save a file in that  
> directory.
>

I was hoping I could do it from within emacs, so the above and 'sudo  
emacs file' (as suggested by whd) are not really a solution to my  
problem. I had a quick glance at tramp (as suggested by Sebastian P.  
Luque and Tim X) and it seems to be to complicated for my simple  
demands, but I will have a closer look soon.

> Or save it to your home directory and move it afterwards as root/ 
> with sudo.

This seems to be the easiest solution indeed and I already did this  
as a quick way around, but I hoped for a more elegant method. Thanks  
for help.

Gruß
Armin

------Mail Adress-------
Armin Goralczyk
Wendenstr. 10
37073 Göttingen

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Edit file write protected by superuser rigths
  2005-08-09 17:58   ` Armin Goralczyk
@ 2005-08-09 18:31     ` Peter Dyballa
  2005-08-09 18:59       ` Armin Goralczyk
       [not found]     ` <mailman.3145.1123612751.20277.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 10+ messages in thread
From: Peter Dyballa @ 2005-08-09 18:31 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 09.08.2005 um 19:58 schrieb Armin Goralczyk:

> I was hoping I could do it from within emacs, so the above and 'sudo 
> emacs file' (as suggested by whd) are not really a solution to my 
> problem

Do you know the meaning of `!´ in dired-mode?

It is very useful! Particularly that it logs all in *Shell Command 
Output*. Try it, to gain some practise!

--
Mit friedvollen Grüßen

   Pete

If all else fails read the instructions. - Donald Knuth

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Edit file write protected by superuser rigths
  2005-08-09 18:31     ` Peter Dyballa
@ 2005-08-09 18:59       ` Armin Goralczyk
  0 siblings, 0 replies; 10+ messages in thread
From: Armin Goralczyk @ 2005-08-09 18:59 UTC (permalink / raw)



Am 09.08.2005 um 20:31 schrieb Peter Dyballa:

>
> Am 09.08.2005 um 19:58 schrieb Armin Goralczyk:
>
>
>> I was hoping I could do it from within emacs, so the above and  
>> 'sudo emacs file' (as suggested by whd) are not really a solution  
>> to my problem
>>
>
> Do you know the meaning of `!´ in dired-mode?
>
No, obviously I am a novice. Thanks for the hint. I will practice.  
Solves my problem too. Perfect.

>
> If all else fails read the instructions. - Donald Knuth

Yes, yes, I know, I agree.

Regards
Armin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Edit file write protected by superuser rigths
       [not found]     ` <mailman.3145.1123612751.20277.help-gnu-emacs@gnu.org>
@ 2005-08-25  0:53       ` David Combs
  2005-08-25  8:50         ` Peter Dyballa
  0 siblings, 1 reply; 10+ messages in thread
From: David Combs @ 2005-08-25  0:53 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 832 bytes --]

In article <mailman.3145.1123612751.20277.help-gnu-emacs@gnu.org>,
Peter Dyballa  <Peter_Dyballa@Web.DE> wrote:
>
>Am 09.08.2005 um 19:58 schrieb Armin Goralczyk:
>
>> I was hoping I could do it from within emacs, so the above and 'sudo 
>> emacs file' (as suggested by whd) are not really a solution to my 
>> problem
>
>Do you know the meaning of `!´ in dired-mode?
>
>It is very useful! Particularly that it logs all in *Shell Command 
>Output*. Try it, to gain some practise!
>
>--
>Mit friedvollen Grüßen
>
>   Pete

Please, exactly what is that "!...4" key-sequence?

(I tried typing it into C-H k, but nothing.)

 (maybe spell it out?)  (your characters got garbled?)


Also, what is the name of the command it is bound to?

With both of those, maybe I can get access to this
nifty feature (whatever it is!).

Thanks!

David

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Edit file write protected by superuser rigths
  2005-08-25  0:53       ` David Combs
@ 2005-08-25  8:50         ` Peter Dyballa
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Dyballa @ 2005-08-25  8:50 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 25.08.2005 um 02:53 schrieb David Combs:

> Please, exactly what is that "!...4" key-sequence?
>
> (I tried typing it into C-H k, but nothing.)
>
>  (maybe spell it out?)  (your characters got garbled?)
>

Get a Mac! Well, it could be intel based ...

The command I mentioned which works in dired-mode only is the 
exclamation mark: ! -- nothing more! When you type it while your cursor 
is on a file or on a directory a shell command can  process it, the 
shell command is input in mini-buffer. This shell command's output 
lands in *Shell Command Output*. Although I remember that there is a 
way to create too an extra buffer with error messages -- I don't 
remember! (Probably too busy.)

--
Greetings

   Pete

Banken sprengen heißt Sonne rein lassen.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-08-25  8:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-08 20:47 Edit file write protected by superuser rigths Armin Goralczyk
2005-08-08 21:35 ` Peter Dyballa
2005-08-09 17:58   ` Armin Goralczyk
2005-08-09 18:31     ` Peter Dyballa
2005-08-09 18:59       ` Armin Goralczyk
     [not found]     ` <mailman.3145.1123612751.20277.help-gnu-emacs@gnu.org>
2005-08-25  0:53       ` David Combs
2005-08-25  8:50         ` Peter Dyballa
     [not found] ` <mailman.3062.1123538567.20277.help-gnu-emacs@gnu.org>
2005-08-08 22:02   ` William Daffer
2005-08-08 22:47 ` Sebastian Luque
     [not found] <mailman.3054.1123534713.20277.help-gnu-emacs@gnu.org>
2005-08-09  8:02 ` Tim X

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.