Page 1 of 1

[solved] fish shell vs. sudo

Posted: Tue Mar 08, 2011 6:55 am
by kwevej
Hi there,

I use fish as my default shell
but - when I use sudo, it asks me to enter password repeatedly, even thou I have sudo timeout set to 15 minutes.

sudo works correctly under bash

Code: Select all

z@pc /t/zTemp> ls
a/  b/
z@pc /t/zTemp> sudo ls
[sudo] password for z:
a  b
z@pc /t/zTemp> sudo ls
[sudo] password for z:
a  b
z@pc /t/zTemp> bash
z@pc /tmp/zTemp $ sudo ls
[sudo] password for z:
a  b
z@pc /tmp/zTemp $ sudo ls
a  b
fish, version 1.23.1

I've contacted fish-user mailing list. Nobody has the same problem.

So, I've booted from LMDE iso - still the same.
Tried to install Debian to VirtualBox - it works!

So there's something wrong with LMDE ...

Re: fish shell vs. sudo

Posted: Tue Mar 08, 2011 7:16 am
by richyrich
Yea, you should read what they think about sudo in the Debian forums . . :wink:

Does it do the same when you use su instead ?

Re: fish shell vs. sudo

Posted: Tue Mar 08, 2011 7:49 am
by kwevej
richyrich wrote:Yea, you should read what they think about sudo in the Debian forums . . :wink:

Does it do the same when you use su instead ?
Well they are missing some use cases ;) - I use sudo within scripts (backup and others)

su -c ls
- asks for the root password
- asks repeatedly both in LMDE and Debian
...and I guess that's how it should be ;)

Re: fish shell vs. sudo

Posted: Tue Mar 08, 2011 8:01 am
by viking777
kwevej wrote:Hi there,

I use fish as my default shell
but - when I use sudo, it asks me to enter password repeatedly, even thou I have sudo timeout set to 15 minutes.

sudo works correctly under bash

Code: Select all

z@pc /t/zTemp> ls
a/  b/
z@pc /t/zTemp> sudo ls
[sudo] password for z:
a  b
z@pc /t/zTemp> sudo ls
[sudo] password for z:
a  b
z@pc /t/zTemp> bash
z@pc /tmp/zTemp $ sudo ls
[sudo] password for z:
a  b
z@pc /tmp/zTemp $ sudo ls
a  b
fish, version 1.23.1

I've contacted fish-user mailing list. Nobody has the same problem.

So, I've booted from LMDE iso - still the same.
Tried to install Debian to VirtualBox - it works!

So there's something wrong with LMDE ...
I have been using fish for many years on various debain based distros including LMDE and have never run into any problems with sudo. However I think it might depend on what you mean by
I use fish as my default shell
If I read that in the literal sense it means that when you run

Code: Select all

echo $SHELL
it will return something like

Code: Select all

/usr/bin/fish
When I run echo $SHELL, I get output like this:
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
graham@acer ~> echo $SHELL
/bin/bash
I have highlighted in bold type the bits that matter.

To achieve this you want to return to bash as the default shell but run the fish environment on top of it.

This is achieved by changing any program path or shortcut (keyboard or otherwise) to something like the following (I will assume you use gnome-terminal as your terminal of choice, if you don't you will have to alter the command accordingly):

Code: Select all

gnome-terminal -e fish
or for a root terminal

Code: Select all

gksu "gnome-terminal -e fish"
You will get the fish shell every time you start a terminal, but I am prepared to bet you will no longer have any problems with sudo.

Of course if you actually need a fish shell as opposed to just a fish terminal that solution will not work for you. For my purposes a fish terminal is fine.

Re: fish shell vs. sudo

Posted: Tue Mar 08, 2011 8:17 am
by kwevej
yep, i changed the shell by chsh -s /usr/bin/fish for my user.


Tried the same in Debian (console) (chsh) ...sudo works
Tried your recommendation - (before switched back to bash via chsh) ... does not work. (the same result in Guake Terminal)

BUT an interesting case - I've switched to console tty1 ... it works there. Even when fish is the default shell.


...I'll try to install gnome desktop to the Debian and we will see....

Re: fish shell vs. sudo

Posted: Tue Mar 08, 2011 9:37 am
by kwevej
OK so neither Debian (fresh Squeeze installation)....

Code: Select all

test@debian:~$ sudo ls
[sudo] password for test: 
Dokumenty  Hudba  Obrázky  Plocha  Stažené  Šablony  Veřejné  Videa
test@debian:~$ sudo ls
Dokumenty  Hudba  Obrázky  Plocha  Stažené  Šablony  Veřejné  Videa
test@debian:~$ fish
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
test@debian ~> sudo ls
[sudo] password for test: 
Dokumenty  Hudba  Obrázky  Plocha  Stažené  Šablony  Veřejné  Videa
test@debian ~> sudo ls
[sudo] password for test: 
Dokumenty  Hudba  Obrázky  Plocha  Stažené  Šablony  Veřejné  Videa
test@debian ~> 
under console - works
under gnome - does not

So it's even larger problem ....

Re: fish shell vs. sudo

Posted: Tue Mar 08, 2011 9:49 am
by kwevej
OK.... solved by turning tty_tickets off .... blah

Code: Select all

Defaults	env_reset, timestamp_timeout=15, !tty_tickets
reference:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=598567

thx all for cooperation