unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Possible issue with sudo in eshell
@ 2012-04-06 10:32 Thierry Volpiatto
  2012-04-06 12:22 ` Sven Joachim
  0 siblings, 1 reply; 5+ messages in thread
From: Thierry Volpiatto @ 2012-04-06 10:32 UTC (permalink / raw)
  To: emacs-devel

Hi all,

when I run a command with sudo in eshell, e.g "sudo ls /etc"
I must enter a password as expected, but I must reenter this password at
each time I repeat the command. This is annoying.

This works fine in M-x shell and term.

It seem the timestamp is recorded in /var/lib/sudo, but eshell is not
reading it before running command again.
I have no idea how to fix this, any hints welcome.

Thanks.

-- 
  Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




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

* Re: Possible issue with sudo in eshell
  2012-04-06 10:32 Possible issue with sudo in eshell Thierry Volpiatto
@ 2012-04-06 12:22 ` Sven Joachim
  2012-04-06 13:11   ` Tom Willemsen
  2012-04-06 16:22   ` Thierry Volpiatto
  0 siblings, 2 replies; 5+ messages in thread
From: Sven Joachim @ 2012-04-06 12:22 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: emacs-devel

On 2012-04-06 12:32 +0200, Thierry Volpiatto wrote:

> Hi all,
>
> when I run a command with sudo in eshell, e.g "sudo ls /etc"
> I must enter a password as expected, but I must reenter this password at
> each time I repeat the command. This is annoying.
>
> This works fine in M-x shell and term.
>
> It seem the timestamp is recorded in /var/lib/sudo, but eshell is not
> reading it before running command again.

That's because eshell special cases sudo and uses an internal command
that calls tramp behind the scenes.  The result is this:

,----
| ~ $ tty
| /dev/pts/3
| ~ $ sudo tty
| not a tty
| ~ $ /usr/bin/sudo tty
| /dev/pts/3
| ~ $ 
`----

If sudo is configured with the tty_tickets option (recommended for
security reasons), you'll have to enter the password each time.

> I have no idea how to fix this, any hints welcome.

I tried "alias sudo /usr/bin/sudo", but that worked badly.  Any eshell
guru around with better suggestions?

Cheers,
       Sven



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

* Re: Possible issue with sudo in eshell
  2012-04-06 12:22 ` Sven Joachim
@ 2012-04-06 13:11   ` Tom Willemsen
  2012-04-06 16:30     ` Thierry Volpiatto
  2012-04-06 16:22   ` Thierry Volpiatto
  1 sibling, 1 reply; 5+ messages in thread
From: Tom Willemsen @ 2012-04-06 13:11 UTC (permalink / raw)
  To: Sven Joachim; +Cc: emacs-devel

Hey guys,

On Fri 06 Apr 2012 02:22:21 PM CEST, Sven Joachim wrote:

 > If sudo is configured with the tty_tickets option (recommended for
 > security reasons), you'll have to enter the password each time.
 >
 > > I have no idea how to fix this, any hints welcome.
 >
 > I tried "alias sudo /usr/bin/sudo", but that worked badly.  Any eshell
 > guru around with better suggestions?

I've got the following in my emacs init file:

(fset 'eshell/sudo nil)

This makes it call /usr/bin/sudo instead of `eshell/sudo', but I still
have to enter my password every time I use it.

Cheers,
Tom



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

* Re: Possible issue with sudo in eshell
  2012-04-06 12:22 ` Sven Joachim
  2012-04-06 13:11   ` Tom Willemsen
@ 2012-04-06 16:22   ` Thierry Volpiatto
  1 sibling, 0 replies; 5+ messages in thread
From: Thierry Volpiatto @ 2012-04-06 16:22 UTC (permalink / raw)
  To: Sven Joachim; +Cc: emacs-devel

Hi Sven,

Sven Joachim <svenjoac@gmx.de> writes:

> On 2012-04-06 12:32 +0200, Thierry Volpiatto wrote:
>
>> Hi all,
>>
>> when I run a command with sudo in eshell, e.g "sudo ls /etc"
>> I must enter a password as expected, but I must reenter this password at
>> each time I repeat the command. This is annoying.
>>
>> This works fine in M-x shell and term.
>>
>> It seem the timestamp is recorded in /var/lib/sudo, but eshell is not
>> reading it before running command again.
>
> That's because eshell special cases sudo and uses an internal command
> that calls tramp behind the scenes.  The result is this:
>
> ,----
> | ~ $ tty
> | /dev/pts/3
> | ~ $ sudo tty
> | not a tty
> | ~ $ /usr/bin/sudo tty
> | /dev/pts/3
> | ~ $ 
> `----

I see, thanks for these infos.

The timestamp is recorded here in "/var/lib/sudo/thierry/3" which would
correspond with /dev/pts/3.

I am already using an alias for sudo:

alias sudo *sudo -p Password: $*

and with it, "sudo tty" always return "/dev/pts/3", but I have anyway to
reenter password at each time.

> If sudo is configured with the tty_tickets option (recommended for
> security reasons), you'll have to enter the password each time.
>
>> I have no idea how to fix this, any hints welcome.
>
> I tried "alias sudo /usr/bin/sudo", but that worked badly.
I think this is same as using "*sudo" which work badly too.


> Any eshell guru around with better suggestions?


-- 
  Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 



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

* Re: Possible issue with sudo in eshell
  2012-04-06 13:11   ` Tom Willemsen
@ 2012-04-06 16:30     ` Thierry Volpiatto
  0 siblings, 0 replies; 5+ messages in thread
From: Thierry Volpiatto @ 2012-04-06 16:30 UTC (permalink / raw)
  To: emacs-devel

Tom Willemsen <tom@ryuslash.org> writes:

> Hey guys,
>
> On Fri 06 Apr 2012 02:22:21 PM CEST, Sven Joachim wrote:
>
>  > If sudo is configured with the tty_tickets option (recommended for
>  > security reasons), you'll have to enter the password each time.
>  >
>  > > I have no idea how to fix this, any hints welcome.
>  >
>  > I tried "alias sudo /usr/bin/sudo", but that worked badly.  Any eshell
>  > guru around with better suggestions?
>
> I've got the following in my emacs init file:
>
> (fset 'eshell/sudo nil)
>
> This makes it call /usr/bin/sudo instead of `eshell/sudo', but I still
> have to enter my password every time I use it.
In eshell you can always use the original command (not its lisp
counterpart) by prefixing with "*" e.g for sudo you can use *sudo to run
/usr/bin/sudo, for grep *grep etc...

-- 
  Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




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

end of thread, other threads:[~2012-04-06 16:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-06 10:32 Possible issue with sudo in eshell Thierry Volpiatto
2012-04-06 12:22 ` Sven Joachim
2012-04-06 13:11   ` Tom Willemsen
2012-04-06 16:30     ` Thierry Volpiatto
2012-04-06 16:22   ` Thierry Volpiatto

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).