* sudo command with minibuffer password prompt
@ 2009-12-16 11:48 Nordlöw
2009-12-16 13:04 ` Pascal J. Bourguignon
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Nordlöw @ 2009-12-16 11:48 UTC (permalink / raw)
To: help-gnu-emacs
Is it possible to call
sudo CMD
from within Emacs and get the password prompt in the minibuffer like
TRAMP does when we open a file with super user privs?
Thanks,
Nordlöw
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sudo command with minibuffer password prompt
2009-12-16 11:48 sudo command with minibuffer password prompt Nordlöw
@ 2009-12-16 13:04 ` Pascal J. Bourguignon
2009-12-16 13:56 ` Nordlöw
2009-12-16 20:37 ` Michael Albinus
2009-12-17 10:44 ` David Kastrup
2 siblings, 1 reply; 10+ messages in thread
From: Pascal J. Bourguignon @ 2009-12-16 13:04 UTC (permalink / raw)
To: help-gnu-emacs
Nordlöw <per.nordlow@gmail.com> writes:
> Is it possible to call
> sudo CMD
> from within Emacs and get the password prompt in the minibuffer like
> TRAMP does when we open a file with super user privs?
This is automatic in emacs 22.
Are you still using emacs 21?
--
__Pascal Bourguignon__
http://www.informatimago.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sudo command with minibuffer password prompt
2009-12-16 13:04 ` Pascal J. Bourguignon
@ 2009-12-16 13:56 ` Nordlöw
2009-12-16 13:59 ` Nordlöw
2009-12-17 2:39 ` Steve Revilak
0 siblings, 2 replies; 10+ messages in thread
From: Nordlöw @ 2009-12-16 13:56 UTC (permalink / raw)
To: help-gnu-emacs
> This is automatic in emacs 22
How?
In both Vanilla Emacs 22 and 23 CVS
(require 'tramp)
(shell-command "sudo touch ~/.emacs")
fails with the message
sudo: no tty present and no askpass program specified
What is missing?
Thanks for your help,
Nordlöw
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sudo command with minibuffer password prompt
2009-12-16 13:56 ` Nordlöw
@ 2009-12-16 13:59 ` Nordlöw
2009-12-17 2:39 ` Steve Revilak
1 sibling, 0 replies; 10+ messages in thread
From: Nordlöw @ 2009-12-16 13:59 UTC (permalink / raw)
To: help-gnu-emacs
> In both Vanilla Emacs 22 and 23 CVS
> (require 'tramp)
> (shell-command "sudo touch ~/.emacs")
> fails with the message
> sudo: no tty present and no askpass program specified
What I really want to do is to spawn an install using apt-get install
from within emacs.
/Nordlöw
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sudo command with minibuffer password prompt
2009-12-16 11:48 sudo command with minibuffer password prompt Nordlöw
2009-12-16 13:04 ` Pascal J. Bourguignon
@ 2009-12-16 20:37 ` Michael Albinus
2009-12-17 10:44 ` David Kastrup
2 siblings, 0 replies; 10+ messages in thread
From: Michael Albinus @ 2009-12-16 20:37 UTC (permalink / raw)
To: Nordlöw; +Cc: help-gnu-emacs
Nordlöw <per.nordlow@gmail.com> writes:
> Is it possible to call
> sudo CMD
> from within Emacs and get the password prompt in the minibuffer like
> TRAMP does when we open a file with super user privs?
In GNU Emacs 23.1.90, I've recently added su and sudo support via Tramp
in eshell. Once you have loaded eshell via "M-x eshell", you can do the
following (for example):
~ $ cd /etc
/etc $ sudo find-file shadow
It works even on remote hosts:
~ $ cd /ssh:otherhost:/etc
/ssh:user@otherhost:/etc $ sudo find-file shadow
The password prompt is handled by Tramp, in the minibuffer.
See (info "(eshell)Built-ins")
> Thanks,
> Nordlöw
Best regards, Michael.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sudo command with minibuffer password prompt
2009-12-16 13:56 ` Nordlöw
2009-12-16 13:59 ` Nordlöw
@ 2009-12-17 2:39 ` Steve Revilak
2009-12-17 6:22 ` Thierry Volpiatto
1 sibling, 1 reply; 10+ messages in thread
From: Steve Revilak @ 2009-12-17 2:39 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 786 bytes --]
>From: Nordl?w <per.nordlow@gmail.com>
>In both Vanilla Emacs 22 and 23 CVS
> (require 'tramp)
> (shell-command "sudo touch ~/.emacs")
>fails with the message
> sudo: no tty present and no askpass program specified
>
>What is missing?
Using M-! and typing "sudo ls" into the minibuffer, I see the same
error message with Emacs 23.1.1 on OpenSuse. Mac OS X displays a
password prompt in the minibuffer, but the password prompt doesn't
seem to accept focus (emacs 22 and 23).
>What I really want to do is to spawn an install using apt-get install
>from within emacs.
Try this.
M-x shell
Then run "sudo apt-get install" from the *shell* buffer. You should
get a password prompt in the minibuffer.
(FWIW, I thought this was one of the neatest additions in Emacs 22 :)
Steve
[-- Attachment #2: Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sudo command with minibuffer password prompt
2009-12-17 2:39 ` Steve Revilak
@ 2009-12-17 6:22 ` Thierry Volpiatto
0 siblings, 0 replies; 10+ messages in thread
From: Thierry Volpiatto @ 2009-12-17 6:22 UTC (permalink / raw)
To: help-gnu-emacs
Hi, if you are an anything user you will find in anything-config.el
sources to manage apt-* from emacs.
http://www.emacswiki.org/cgi-bin/emacs/Anything
Steve Revilak <steve@srevilak.net> writes:
>>From: Nordl?w <per.nordlow@gmail.com>
>
>>In both Vanilla Emacs 22 and 23 CVS
>> (require 'tramp)
>> (shell-command "sudo touch ~/.emacs")
>>fails with the message
>> sudo: no tty present and no askpass program specified
>>
>>What is missing?
>
> Using M-! and typing "sudo ls" into the minibuffer, I see the same
> error message with Emacs 23.1.1 on OpenSuse. Mac OS X displays a
> password prompt in the minibuffer, but the password prompt doesn't
> seem to accept focus (emacs 22 and 23).
>
>>What I really want to do is to spawn an install using apt-get install
>>from within emacs.
>
> Try this.
>
> M-x shell
>
> Then run "sudo apt-get install" from the *shell* buffer. You should
> get a password prompt in the minibuffer.
>
> (FWIW, I thought this was one of the neatest additions in Emacs 22 :)
>
> Steve
>
--
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sudo command with minibuffer password prompt
[not found] ` <mailman.13084.1261017601.2239.help-gnu-emacs@gnu.org>
@ 2009-12-17 10:03 ` Nordlöw
2009-12-17 21:15 ` Pascal J. Bourguignon
0 siblings, 1 reply; 10+ messages in thread
From: Nordlöw @ 2009-12-17 10:03 UTC (permalink / raw)
To: help-gnu-emacs
> Then run "sudo apt-get install" from the *shell* buffer. You should
> get a password prompt in the minibuffer.
Nice1
But I still need to solve this programmatically in a lisp program.
I'll take a look at eshell and see if I can script it using eshell-
functions.
/Nordlöw
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sudo command with minibuffer password prompt
2009-12-16 11:48 sudo command with minibuffer password prompt Nordlöw
2009-12-16 13:04 ` Pascal J. Bourguignon
2009-12-16 20:37 ` Michael Albinus
@ 2009-12-17 10:44 ` David Kastrup
2 siblings, 0 replies; 10+ messages in thread
From: David Kastrup @ 2009-12-17 10:44 UTC (permalink / raw)
To: help-gnu-emacs
Nordlöw <per.nordlow@gmail.com> writes:
> Is it possible to call
> sudo CMD
> from within Emacs and get the password prompt in the minibuffer like
> TRAMP does when we open a file with super user privs?
Something like
(with-temp-buffer
(cd "/sudo::/")
(shell-command "cat /etc/shadow"))
should work.
--
David Kastrup
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sudo command with minibuffer password prompt
2009-12-17 10:03 ` Nordlöw
@ 2009-12-17 21:15 ` Pascal J. Bourguignon
0 siblings, 0 replies; 10+ messages in thread
From: Pascal J. Bourguignon @ 2009-12-17 21:15 UTC (permalink / raw)
To: help-gnu-emacs
Nordlöw <per.nordlow@gmail.com> writes:
>> Then run "sudo apt-get install" from the *shell* buffer. You should
>> get a password prompt in the minibuffer.
>
> Nice1
>
> But I still need to solve this programmatically in a lisp program.
> I'll take a look at eshell and see if I can script it using eshell-
> functions.
In the case of M-x shell, it's comint that's working, and there must
be some comint filter installed by shell. Having a look at that code
should allow you to learn how to do it programmatically.
Of course, an alternative would be to see how tramp does it, and do it
that way.
Use the source, Luke!
--
__Pascal Bourguignon__
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2009-12-17 21:15 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-16 11:48 sudo command with minibuffer password prompt Nordlöw
2009-12-16 13:04 ` Pascal J. Bourguignon
2009-12-16 13:56 ` Nordlöw
2009-12-16 13:59 ` Nordlöw
2009-12-17 2:39 ` Steve Revilak
2009-12-17 6:22 ` Thierry Volpiatto
2009-12-16 20:37 ` Michael Albinus
2009-12-17 10:44 ` David Kastrup
[not found] <20091216170829.14846AF606@mxperim7.sea5.speakeasy.net>
[not found] ` <mailman.13084.1261017601.2239.help-gnu-emacs@gnu.org>
2009-12-17 10:03 ` Nordlöw
2009-12-17 21:15 ` Pascal J. Bourguignon
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.