* SU commands from Emacs
@ 2007-08-17 17:38 Joel J. Adamson
2007-08-17 18:23 ` Emilio Lopes
` (4 more replies)
0 siblings, 5 replies; 25+ messages in thread
From: Joel J. Adamson @ 2007-08-17 17:38 UTC (permalink / raw)
To: help-gnu-emacs
Howdy,
I've almost completed the transition from using a terminal emulator to
using Emacs exclusively, by using Dired, Ange-ftp, etc. (not that I
was trying, I just noticed how much more convenient it is).
The one remaining problem is executing shell commands that need root
permission. I can use Dired and edit files with "/su::" tramp-mode,
however sometimes I just need to execute a command. I have sudo
installed on Slackware Linux 12.0, but the password prompt does not
come up properly.
Thanks,
Joel
--
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA 02114
(617) 643-1432
(303) 880-3109
"It can be interesting to study ancient philosophy, but more as a kind
of accident report than to teach you anything useful."
--Paul Graham
http://www.paulgraham.com/raq.html
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: SU commands from Emacs
2007-08-17 17:38 SU commands from Emacs Joel J. Adamson
@ 2007-08-17 18:23 ` Emilio Lopes
2007-08-17 19:38 ` Joel J. Adamson
2007-08-17 19:04 ` David Hansen
` (3 subsequent siblings)
4 siblings, 1 reply; 25+ messages in thread
From: Emilio Lopes @ 2007-08-17 18:23 UTC (permalink / raw)
To: help-gnu-emacs
Joel J Adamson writes:
> [...] I have sudo installed on Slackware Linux 12.0, but the password
> prompt does not come up properly.
I guess the problem is that one of your shell init files probably
(executes a command which) writes to STDOUT.
--
Emílio C. Lopes
Munich, Germany
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: SU commands from Emacs
2007-08-17 18:23 ` Emilio Lopes
@ 2007-08-17 19:38 ` Joel J. Adamson
2007-08-18 9:55 ` Emilio Lopes
0 siblings, 1 reply; 25+ messages in thread
From: Joel J. Adamson @ 2007-08-17 19:38 UTC (permalink / raw)
To: help-gnu-emacs
Emilio Lopes <eclig@gmx.net> writes:
> Joel J Adamson writes:
>
>> [...] I have sudo installed on Slackware Linux 12.0, but the password
>> prompt does not come up properly.
>
> I guess the problem is that one of your shell init files probably
> (executes a command which) writes to STDOUT.
Where should I have it send the output? How do I get it to the
minibuffer so I can interact with it?
Joel
--
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA 02114
(617) 643-1432
(303) 880-3109
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: SU commands from Emacs
2007-08-17 19:38 ` Joel J. Adamson
@ 2007-08-18 9:55 ` Emilio Lopes
0 siblings, 0 replies; 25+ messages in thread
From: Emilio Lopes @ 2007-08-18 9:55 UTC (permalink / raw)
To: help-gnu-emacs
Joel J Adamson writes:
> Emilio Lopes <eclig@gmx.net> writes:
>> Joel J Adamson writes:
>>
>>> [...] I have sudo installed on Slackware Linux 12.0, but the password
>>> prompt does not come up properly.
>>
>> I guess the problem is that one of your shell init files probably
>> (executes a command which) writes to STDOUT.
> Where should I have it send the output? How do I get it to the
> minibuffer so I can interact with it?
Reading the other follow-ups I'm not sure this is really the problem
in this specific case. This is mostly a problem for ssh and also for
sudo IIRC. Your shell init files should not produce any output ("good
morning" greeting, email headers, fortunes, ...) unless the shell is
interactive and it's connected to a terminal.
Bash sets the variable PS1 iff the shell is interactive. You can
check if the shell is connected to a terminal using e.g. "test -t 1".
--
Emílio C. Lopes
Munich, Germany
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: SU commands from Emacs
2007-08-17 17:38 SU commands from Emacs Joel J. Adamson
2007-08-17 18:23 ` Emilio Lopes
@ 2007-08-17 19:04 ` David Hansen
2007-08-17 19:27 ` Peter Dyballa
` (2 subsequent siblings)
4 siblings, 0 replies; 25+ messages in thread
From: David Hansen @ 2007-08-17 19:04 UTC (permalink / raw)
To: help-gnu-emacs
On Fri, 17 Aug 2007 13:38:59 -0400 Joel J. Adamson wrote:
> The one remaining problem is executing shell commands that need root
> permission. I can use Dired and edit files with "/su::" tramp-mode,
> however sometimes I just need to execute a command. I have sudo
> installed on Slackware Linux 12.0, but the password prompt does not
> come up properly.
I use
(defun root-shell (&optional arg)
(interactive "P")
(let ((explicit-shell-file-name "sudo"))
(shell (if arg
(generate-new-buffer-name "*root shell*")
"*root shell*"))
;; change this to your roots home directory
(setq default-directory "/root/")))
David
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: SU commands from Emacs
2007-08-17 17:38 SU commands from Emacs Joel J. Adamson
2007-08-17 18:23 ` Emilio Lopes
2007-08-17 19:04 ` David Hansen
@ 2007-08-17 19:27 ` Peter Dyballa
[not found] ` <mailman.4925.1187378874.32220.help-gnu-emacs@gnu.org>
[not found] ` <mailman.4924.1187377704.32220.help-gnu-emacs@gnu.org>
4 siblings, 0 replies; 25+ messages in thread
From: Peter Dyballa @ 2007-08-17 19:27 UTC (permalink / raw)
To: Joel J. Adamson; +Cc: help-gnu-emacs
Am 17.08.2007 um 19:38 schrieb Joel J. Adamson:
> I have sudo installed on Slackware Linux 12.0, but the password
> prompt does not come up properly.
What do you mean? It's correct behaviour when the password prompt
appears in mini-buffer and every character you type there is replaced
by a dot character.
--
Greetings
Pete
"If we don't succeed, we run the risk of failure."
George W. Bush
^ permalink raw reply [flat|nested] 25+ messages in thread
[parent not found: <mailman.4925.1187378874.32220.help-gnu-emacs@gnu.org>]
* Re: SU commands from Emacs
[not found] ` <mailman.4925.1187378874.32220.help-gnu-emacs@gnu.org>
@ 2007-08-17 20:23 ` Joel J. Adamson
2007-08-17 20:37 ` Sven Joachim
0 siblings, 1 reply; 25+ messages in thread
From: Joel J. Adamson @ 2007-08-17 20:23 UTC (permalink / raw)
To: help-gnu-emacs
Peter Dyballa <Peter_Dyballa@Web.DE> writes:
> Am 17.08.2007 um 19:38 schrieb Joel J. Adamson:
>
>> I have sudo installed on Slackware Linux 12.0, but the password
>> prompt does not come up properly.
>
> What do you mean? It's correct behaviour when the password prompt
> appears in mini-buffer and every character you type there is replaced
> by a dot character.
>
Then I'm not seeing the normal behavior. The "Password:" prompt
appears in the minibuffer, I type and I get an error (no dots).
Perhaps I need to configure sudo?
Joel
--
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA 02114
(617) 643-1432
(303) 880-3109
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: SU commands from Emacs
2007-08-17 20:23 ` Joel J. Adamson
@ 2007-08-17 20:37 ` Sven Joachim
0 siblings, 0 replies; 25+ messages in thread
From: Sven Joachim @ 2007-08-17 20:37 UTC (permalink / raw)
To: help-gnu-emacs
jadamson@partners.org (Joel J. Adamson) writes:
> Then I'm not seeing the normal behavior. The "Password:" prompt
> appears in the minibuffer, I type and I get an error (no dots).
Actually, it's not the minibuffer, but rather the echo area, I
suspect. Since shell-command does not read input, you cannot enter
the password. :-(
> Perhaps I need to configure sudo?
You can type 'sudo -v' in a terminal and use sudo in shell-command as
long as the ticket is valid. That is what I do.
Regards,
Sven
^ permalink raw reply [flat|nested] 25+ messages in thread
[parent not found: <mailman.4924.1187377704.32220.help-gnu-emacs@gnu.org>]
* Re: SU commands from Emacs
[not found] ` <mailman.4924.1187377704.32220.help-gnu-emacs@gnu.org>
@ 2007-08-17 20:28 ` Joel J. Adamson
2007-08-24 6:38 ` Dieter Wilhelm
[not found] ` <mailman.5238.1187937431.32220.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 25+ messages in thread
From: Joel J. Adamson @ 2007-08-17 20:28 UTC (permalink / raw)
To: help-gnu-emacs
David Hansen <david.hansen@gmx.net> writes:
> On Fri, 17 Aug 2007 13:38:59 -0400 Joel J. Adamson wrote:
>
>> The one remaining problem is executing shell commands that need root
>> permission. I can use Dired and edit files with "/su::" tramp-mode,
>> however sometimes I just need to execute a command. I have sudo
>> installed on Slackware Linux 12.0, but the password prompt does not
>> come up properly.
>
> I use
>
> (defun root-shell (&optional arg)
> (interactive "P")
> (let ((explicit-shell-file-name "sudo"))
> (shell (if arg
> (generate-new-buffer-name "*root shell*")
> "*root shell*"))
> ;; change this to your roots home directory
> (setq default-directory "/root/")))
Thanks David, that's slightly more convenient than entering a terminal
emulator *and then* entering "su..." --- but I mean something
different. I'd like to run root commands straight from an editor
window, for example Dired. Deleting files is fine, I just do dired
with "/su::<directory>" and then run the regular dired commands.
Sometimes I want to do a command that requires root privileges.
Joel
--
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA 02114
(617) 643-1432
(303) 880-3109
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: SU commands from Emacs
2007-08-17 20:28 ` Joel J. Adamson
@ 2007-08-24 6:38 ` Dieter Wilhelm
2007-08-24 9:37 ` Michael Albinus
2007-08-24 9:51 ` Peter Dyballa
[not found] ` <mailman.5238.1187937431.32220.help-gnu-emacs@gnu.org>
1 sibling, 2 replies; 25+ messages in thread
From: Dieter Wilhelm @ 2007-08-24 6:38 UTC (permalink / raw)
To: Joel J. Adamson; +Cc: help-gnu-emacs
jadamson@partners.org (Joel J. Adamson) writes:
> Sometimes I want to do a command that requires root privileges.
Yes, lately I stumbled over a find-grep in /etc. How could this be
done with root privileges?
--
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: SU commands from Emacs
2007-08-24 6:38 ` Dieter Wilhelm
@ 2007-08-24 9:37 ` Michael Albinus
2007-08-24 20:32 ` Dieter Wilhelm
[not found] ` <mailman.5288.1187987493.32220.help-gnu-emacs@gnu.org>
2007-08-24 9:51 ` Peter Dyballa
1 sibling, 2 replies; 25+ messages in thread
From: Michael Albinus @ 2007-08-24 9:37 UTC (permalink / raw)
To: Dieter Wilhelm; +Cc: help-gnu-emacs, Joel J. Adamson
Dieter Wilhelm <dieter@duenenhof-wilhelm.de> writes:
> Yes, lately I stumbled over a find-grep in /etc. How could this be
> done with root privileges?
Tramp 2.1 supports it. It is synchronized with the Emacs CVS sources.
Open "/sudo::/etc", and apply "M-x find-grep".
Best regards, Michael.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: SU commands from Emacs
2007-08-24 9:37 ` Michael Albinus
@ 2007-08-24 20:32 ` Dieter Wilhelm
2007-08-24 22:16 ` Peter Dyballa
[not found] ` <mailman.5288.1187987493.32220.help-gnu-emacs@gnu.org>
1 sibling, 1 reply; 25+ messages in thread
From: Dieter Wilhelm @ 2007-08-24 20:32 UTC (permalink / raw)
To: Michael Albinus; +Cc: help-gnu-emacs, Joel J. Adamson
Michael Albinus <michael.albinus@gmx.de> writes:
> Dieter Wilhelm <dieter@duenenhof-wilhelm.de> writes:
>
>> Yes, lately I stumbled over a find-grep in /etc. How could this be
>> done with root privileges?
>
> Tramp 2.1 supports it. It is synchronized with the Emacs CVS sources.
> Open "/sudo::/etc", and apply "M-x find-grep".
>
Great! Thanks a lot.
By the way, can you specify between the double colons another user
except root as well?
--
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: SU commands from Emacs
2007-08-24 20:32 ` Dieter Wilhelm
@ 2007-08-24 22:16 ` Peter Dyballa
2007-08-25 2:45 ` Dieter Wilhelm
2007-08-25 19:35 ` Joel J. Adamson
0 siblings, 2 replies; 25+ messages in thread
From: Peter Dyballa @ 2007-08-24 22:16 UTC (permalink / raw)
To: Dieter Wilhelm; +Cc: help-gnu-emacs, Michael Albinus, Joel J. Adamson
Am 24.08.2007 um 22:32 schrieb Dieter Wilhelm:
> By the way, can you specify between the double colons another user
> except root as well?
The "default" use is
/USER@MACHINE:/PATH/TO.FILE
You're allowed to add a particular method:
/METHOD:USER@MACHINE:/PATH/TO.FILE
The method sudo usually needs neither a host nor a user name, but
somehow you need to tell TRAMP these two empty names. So you end up with
/sudo::/PATH/TO.FILE
If you find some time you could try it with a
/sudo:USER:/PATH/TO.FILE
and see what happens ...
--
Mit friedvollen Grüßen
Pete
Der Unterschied zwischen Theorie und Praxis ist in Praxis meist
größer als in der Theorie
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: SU commands from Emacs
2007-08-24 22:16 ` Peter Dyballa
@ 2007-08-25 2:45 ` Dieter Wilhelm
2007-08-25 19:35 ` Joel J. Adamson
1 sibling, 0 replies; 25+ messages in thread
From: Dieter Wilhelm @ 2007-08-25 2:45 UTC (permalink / raw)
To: Peter Dyballa; +Cc: help-gnu-emacs, Michael Albinus, Joel J. Adamson
Peter Dyballa <Peter_Dyballa@Web.DE> writes:
> Am 24.08.2007 um 22:32 schrieb Dieter Wilhelm:
>
>> By the way, can you specify between the double colons another user
>> except root as well?
>
> The "default" use is
>
> /USER@MACHINE:/PATH/TO.FILE
>
> You're allowed to add a particular method:
>
> /METHOD:USER@MACHINE:/PATH/TO.FILE
>
> The method sudo usually needs neither a host nor a user name, but
> somehow you need to tell TRAMP these two empty names. So you end up
> with
>
> /sudo::/PATH/TO.FILE
>
> If you find some time you could try it with a
>
> /sudo:USER:/PATH/TO.FILE
>
> and see what happens ...
I created a new user: helga
/su:helga: gives
tramp-open-connection-su: Cannot connect to different host `helga' with `su' connection method [10 times]
/su:helga@debby: works fine, thanks
--
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: SU commands from Emacs
2007-08-24 22:16 ` Peter Dyballa
2007-08-25 2:45 ` Dieter Wilhelm
@ 2007-08-25 19:35 ` Joel J. Adamson
2007-08-26 8:49 ` Michael Albinus
1 sibling, 1 reply; 25+ messages in thread
From: Joel J. Adamson @ 2007-08-25 19:35 UTC (permalink / raw)
To: Peter Dyballa; +Cc: Dieter Wilhelm, help-gnu-emacs, Michael Albinus
Peter Dyballa <Peter_Dyballa@Web.DE> writes:
> Am 24.08.2007 um 22:32 schrieb Dieter Wilhelm:
>
>> By the way, can you specify between the double colons another user
>> except root as well?
>
> The "default" use is
>
> /USER@MACHINE:/PATH/TO.FILE
>
Howdy,
FYI I tried this at home, trying to get into my wife's files (i.e.,
abusing my system administrator privileges) and got an error; I
switched her shell from zsh back to bash and it worked. With a little
more digging, I may find the way to set up Z Shell options so this
will work. Is there any way to configure tramp for this?
Joel
--
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA 02114
(617) 643-1432
(303) 880-3109
The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this information in error, please contact the Compliance HelpLine at 800-856-1983 and properly dispose of this information.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: SU commands from Emacs
2007-08-25 19:35 ` Joel J. Adamson
@ 2007-08-26 8:49 ` Michael Albinus
2007-08-27 13:28 ` Joel J. Adamson
0 siblings, 1 reply; 25+ messages in thread
From: Michael Albinus @ 2007-08-26 8:49 UTC (permalink / raw)
To: Joel J. Adamson; +Cc: Dieter Wilhelm, Peter Dyballa, help-gnu-emacs
jadamson@partners.org (Joel J. Adamson) writes:
> Howdy,
Hi,
> FYI I tried this at home, trying to get into my wife's files (i.e.,
> abusing my system administrator privileges) and got an error; I
> switched her shell from zsh back to bash and it worked. With a little
> more digging, I may find the way to set up Z Shell options so this
> will work. Is there any way to configure tramp for this?
See the Tramp manual, chapter Frequently Asked Questions.
> Joel
Best regars, Michael.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: SU commands from Emacs
2007-08-26 8:49 ` Michael Albinus
@ 2007-08-27 13:28 ` Joel J. Adamson
0 siblings, 0 replies; 25+ messages in thread
From: Joel J. Adamson @ 2007-08-27 13:28 UTC (permalink / raw)
To: Michael Albinus; +Cc: Dieter Wilhelm, Peter Dyballa, help-gnu-emacs
Michael Albinus <michael.albinus@gmx.de> writes:
> jadamson@partners.org (Joel J. Adamson) writes:
>
>> Howdy,
>
> Hi,
>
[...]
>
> See the Tramp manual, chapter Frequently Asked Questions.
Thanks!
Joel
--
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA 02114
(617) 643-1432
(303) 880-3109
The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this information in error, please contact the Compliance HelpLine at 800-856-1983 and properly dispose of this information.
^ permalink raw reply [flat|nested] 25+ messages in thread
[parent not found: <mailman.5288.1187987493.32220.help-gnu-emacs@gnu.org>]
* Re: SU commands from Emacs
[not found] ` <mailman.5288.1187987493.32220.help-gnu-emacs@gnu.org>
@ 2007-08-24 21:55 ` David Kastrup
2007-08-25 3:00 ` Dieter Wilhelm
0 siblings, 1 reply; 25+ messages in thread
From: David Kastrup @ 2007-08-24 21:55 UTC (permalink / raw)
To: help-gnu-emacs
Dieter Wilhelm <dieter@duenenhof-wilhelm.de> writes:
> Michael Albinus <michael.albinus@gmx.de> writes:
>
>> Dieter Wilhelm <dieter@duenenhof-wilhelm.de> writes:
>>
>>> Yes, lately I stumbled over a find-grep in /etc. How could this be
>>> done with root privileges?
>>
>> Tramp 2.1 supports it. It is synchronized with the Emacs CVS sources.
>> Open "/sudo::/etc", and apply "M-x find-grep".
>>
> Great! Thanks a lot.
>
> By the way, can you specify between the double colons another user
> except root as well?
/sudo:dieter@:/etc
It is not like this is not documented in the tramp manual.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: SU commands from Emacs
2007-08-24 21:55 ` David Kastrup
@ 2007-08-25 3:00 ` Dieter Wilhelm
2007-08-26 10:55 ` Michael Albinus
0 siblings, 1 reply; 25+ messages in thread
From: Dieter Wilhelm @ 2007-08-25 3:00 UTC (permalink / raw)
To: David Kastrup; +Cc: help-gnu-emacs
David Kastrup <dak@gnu.org> writes:
> Dieter Wilhelm <dieter@duenenhof-wilhelm.de> writes:
>
>> Michael Albinus <michael.albinus@gmx.de> writes:
>>
>>> Dieter Wilhelm <dieter@duenenhof-wilhelm.de> writes:
>>>
>>>> Yes, lately I stumbled over a find-grep in /etc. How could this be
>>>> done with root privileges?
>>>
>>> Tramp 2.1 supports it. It is synchronized with the Emacs CVS sources.
>>> Open "/sudo::/etc", and apply "M-x find-grep".
>>>
>> Great! Thanks a lot.
>>
>> By the way, can you specify between the double colons another user
>> except root as well?
>
> /sudo:dieter@:/etc
This notation of leaving out the host is also new to me, thanks
On second thought: shouldn't /su:name@localhost:/dir not be equivalent
to /name@localhost:/dir
> It is not like this is not documented in the tramp manual.
Admitted, I did not read the *whole* documentation of tramp and so the
notation was not so obvious and as far as I leaved through the info
pages the information is not placed at a prominent point.
--
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: SU commands from Emacs
2007-08-25 3:00 ` Dieter Wilhelm
@ 2007-08-26 10:55 ` Michael Albinus
0 siblings, 0 replies; 25+ messages in thread
From: Michael Albinus @ 2007-08-26 10:55 UTC (permalink / raw)
To: Dieter Wilhelm; +Cc: help-gnu-emacs, David Kastrup
Dieter Wilhelm <dieter@duenenhof-wilhelm.de> writes:
> On second thought: shouldn't /su:name@localhost:/dir not be equivalent
> to /name@localhost:/dir
You can define your own defaults. Check for the variables
tramp-default-method, tramp-default-host, tramp-default-user,
tramp-default-method-alist, tramp-default-proxies-alist and
tramp-default-user-alist in the documentation.
Your proposal above is not applicable everywhere. For example, Ubuntu
does not allow su for root; it requires sudo.
However, you can define it yourself with
(add-to-list 'tramp-default-method-alist '("\\`localhost\\'" nil "su"))
Best regards, Michael.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: SU commands from Emacs
2007-08-24 6:38 ` Dieter Wilhelm
2007-08-24 9:37 ` Michael Albinus
@ 2007-08-24 9:51 ` Peter Dyballa
1 sibling, 0 replies; 25+ messages in thread
From: Peter Dyballa @ 2007-08-24 9:51 UTC (permalink / raw)
To: Dieter Wilhelm; +Cc: help-gnu-emacs, Joel J. Adamson
Am 24.08.2007 um 08:38 schrieb Dieter Wilhelm:
> jadamson@partners.org (Joel J. Adamson) writes:
>
>> Sometimes I want to do a command that requires root privileges.
>
> Yes, lately I stumbled over a find-grep in /etc. How could this be
> done with root privileges?
>
Use Tramp: C-x d /sudo::/etc RET and then do the usual things, find-
grep, occur, or whatever. Once you've opened a directory with root
privileges all subsequently following commands (f or e or ! in dired-
mode for example) are as by root. So you better work very carefully ...
--
Mit friedvollen Grüßen
Pete
“One cannot live by television, video games, top ten CDs, and dumb
movies alone”
(Amiri Baraka 1999)
^ permalink raw reply [flat|nested] 25+ messages in thread
[parent not found: <mailman.5238.1187937431.32220.help-gnu-emacs@gnu.org>]
* Re: SU commands from Emacs
[not found] ` <mailman.5238.1187937431.32220.help-gnu-emacs@gnu.org>
@ 2007-08-24 7:59 ` Tim X
2007-08-24 20:20 ` Dieter Wilhelm
[not found] ` <mailman.5305.1188026786.32220.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 25+ messages in thread
From: Tim X @ 2007-08-24 7:59 UTC (permalink / raw)
To: help-gnu-emacs
Dieter Wilhelm <dieter@duenenhof-wilhelm.de> writes:
> jadamson@partners.org (Joel J. Adamson) writes:
>
>> Sometimes I want to do a command that requires root privileges.
>
> Yes, lately I stumbled over a find-grep in /etc. How could this be
> done with root privileges?
>
I use either sudo or su within a shell or term buffer to run commands as
root.
I can't think of any straight-forward way to run elisp/emacs commands with
the privileges of another user - there just isn't a mechanism to do
this. The closest I could think of would be using some sort of
emacsclient/emacserver setup, but this would require having another emacs
running as root, which doesn't seem practicle to me.
I have seen something in the most recent emacs docs that indicate tramp may
be able to execute processes on remote servers. If this is the case, it
should be possible, in conjunction with sudo/su as a connection method to
execute commands as root via tramp.
If you positively, must, have to run emacs commands as another user, I
guess you could call emacs in 'batch' mode, with a function call on the
command line - it may be possible to have the output sent back into a
buffer in the local emacs (i.e. like output from a shell command), but this
is going to be very slow and use a lot of resources (memory/cpu etc)
If the reason you want to use emacs to do processing as another user is
because you like to write stuff in lisp, then maybe something like lush
(Lisp User Shell), rep (lisp/scheme interpreter) scsh (scheme shell) or
even one of the mainstream CL implementations, like clisp, cmucl or sbcl
will give you what you want.
HTH
Tim
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: SU commands from Emacs
2007-08-24 7:59 ` Tim X
@ 2007-08-24 20:20 ` Dieter Wilhelm
[not found] ` <mailman.5305.1188026786.32220.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 25+ messages in thread
From: Dieter Wilhelm @ 2007-08-24 20:20 UTC (permalink / raw)
To: help-gnu-emacs
Hi Tim,
normally I'm also using commands which require root privileges from
the shell buffer. But I'm forcing myself to use more and more Emacs
inbuilt functionality. In this line of reasoning using find-grep on
/etc was actually inattentiveness on my side. Reading the su command
thread I was wondering if Emacs could even do privileged operations on
directories. And low and behold it can! Emacs never ceases to amaze.
Michael Albinus and Peter Dyballa, as you probably already have read,
explained that the new tramp version in CVS is able to do this via a
dired buffer and the sudo prefix as you hinted at. Even though it
might turn out to be a bit dangerous for inattentive users ;-).
The idea of you with multiple Emacs processes seems not so far fetched
in general. I read that some users are doing this quite comfortably.
But as I'm only occasionally dabble with computers it's clearly not
necessary. But I'll check the tramp method when I'm in the mood to
download the CVS version.
Also thank you for the hints with the lisp shells, good to know that
they exist. Why do you mention Scheme as well, how it is related to
Emacs and Elisp?
--
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany
^ permalink raw reply [flat|nested] 25+ messages in thread
[parent not found: <mailman.5305.1188026786.32220.help-gnu-emacs@gnu.org>]
* Re: SU commands from Emacs
[not found] ` <mailman.5305.1188026786.32220.help-gnu-emacs@gnu.org>
@ 2007-08-25 9:28 ` Tim X
2007-08-25 13:57 ` Dieter Wilhelm
0 siblings, 1 reply; 25+ messages in thread
From: Tim X @ 2007-08-25 9:28 UTC (permalink / raw)
To: help-gnu-emacs
Dieter Wilhelm <dieter@duenenhof-wilhelm.de> writes:
> Hi Tim,
>
> normally I'm also using commands which require root privileges from
> the shell buffer. But I'm forcing myself to use more and more Emacs
> inbuilt functionality. In this line of reasoning using find-grep on
> /etc was actually inattentiveness on my side. Reading the su command
> thread I was wondering if Emacs could even do privileged operations on
> directories. And low and behold it can! Emacs never ceases to amaze.
>
> Michael Albinus and Peter Dyballa, as you probably already have read,
> explained that the new tramp version in CVS is able to do this via a
> dired buffer and the sudo prefix as you hinted at. Even though it
> might turn out to be a bit dangerous for inattentive users ;-).
>
> The idea of you with multiple Emacs processes seems not so far fetched
> in general. I read that some users are doing this quite comfortably.
> But as I'm only occasionally dabble with computers it's clearly not
> necessary. But I'll check the tramp method when I'm in the mood to
> download the CVS version.
>
> Also thank you for the hints with the lisp shells, good to know that
> they exist. Why do you mention Scheme as well, how it is related to
> Emacs and Elisp?
>
I mention the scheme shells only because scheme is another lisp
dialect. anyone who is familiar with emacs lisp or common lisp probably
won't have too much difficulty learning a scheme based shell.
Tim
--
tcross (at) rapttech dot com dot au
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: SU commands from Emacs
2007-08-25 9:28 ` Tim X
@ 2007-08-25 13:57 ` Dieter Wilhelm
0 siblings, 0 replies; 25+ messages in thread
From: Dieter Wilhelm @ 2007-08-25 13:57 UTC (permalink / raw)
To: Tim X; +Cc: help-gnu-emacs
Tim X <timx@nospam.dev.null> writes:
>
> I mention the scheme shells only because scheme is another lisp
> dialect. anyone who is familiar with emacs lisp or common lisp probably
> won't have too much difficulty learning a scheme based shell.
I see, scheme is a dialect of lisp, only heard it in conjunction with
scheme-mode in Emacs.
Bye
Dieter
--
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2007-08-27 13:28 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-17 17:38 SU commands from Emacs Joel J. Adamson
2007-08-17 18:23 ` Emilio Lopes
2007-08-17 19:38 ` Joel J. Adamson
2007-08-18 9:55 ` Emilio Lopes
2007-08-17 19:04 ` David Hansen
2007-08-17 19:27 ` Peter Dyballa
[not found] ` <mailman.4925.1187378874.32220.help-gnu-emacs@gnu.org>
2007-08-17 20:23 ` Joel J. Adamson
2007-08-17 20:37 ` Sven Joachim
[not found] ` <mailman.4924.1187377704.32220.help-gnu-emacs@gnu.org>
2007-08-17 20:28 ` Joel J. Adamson
2007-08-24 6:38 ` Dieter Wilhelm
2007-08-24 9:37 ` Michael Albinus
2007-08-24 20:32 ` Dieter Wilhelm
2007-08-24 22:16 ` Peter Dyballa
2007-08-25 2:45 ` Dieter Wilhelm
2007-08-25 19:35 ` Joel J. Adamson
2007-08-26 8:49 ` Michael Albinus
2007-08-27 13:28 ` Joel J. Adamson
[not found] ` <mailman.5288.1187987493.32220.help-gnu-emacs@gnu.org>
2007-08-24 21:55 ` David Kastrup
2007-08-25 3:00 ` Dieter Wilhelm
2007-08-26 10:55 ` Michael Albinus
2007-08-24 9:51 ` Peter Dyballa
[not found] ` <mailman.5238.1187937431.32220.help-gnu-emacs@gnu.org>
2007-08-24 7:59 ` Tim X
2007-08-24 20:20 ` Dieter Wilhelm
[not found] ` <mailman.5305.1188026786.32220.help-gnu-emacs@gnu.org>
2007-08-25 9:28 ` Tim X
2007-08-25 13:57 ` Dieter Wilhelm
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.