Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Switched to Zsh - Can not use su or sudo
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
dman777
l33t
l33t


Joined: 10 Jan 2007
Posts: 910

PostPosted: Mon Sep 03, 2018 2:43 am    Post subject: Switched to Zsh - Can not use su or sudo Reply with quote

I switched to zsh from bash using the gentoo zsh wiki.

The only issue I am hitting, so far, is that I can not su and also it does not seem that sudo is working ether:


The below examples works in bash, but not in zsh:
Code:
one@localhost ~
% su
Password:
Sorry, user one is not allowed to execute '/bin/su' as root on localhost.


Code:
one@localhost ~
% sudo wpa_cli
Password:
Sorry, user one is not allowed to execute '/usr/bin/wpa_cli' as root on localhost
.

sudo tab completion works, so not sure what might be wrong.
_________________
<h5>Checkout <em>#grandmasboy</em> on <em>freenode</em>...chat with jayP bot from the movie!</h5>
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6229
Location: Room 101

PostPosted: Mon Sep 03, 2018 10:00 am    Post subject: Reply with quote

dman777 ...

please show us the output of 'groups' for user 'one' ... 'one' will need to be in 'wheel' to run su and sudo (though it would suprise me that bash doesn't behave similarly this being the case). If they are not in 'wheel', then add them using the following:

Code:
# usermod -a -G wheel one

Also:

~/.zprofile:
if [[ $EUID != 0 ]] && (($+commands[sudo])) ; then
    typeset -xT SUDO_PATH sudo_path
    typeset -U sudo_path
    sudo_path=({,/usr/local,/usr}/sbin(N-/))
fi

~/.zshrc:
zstyle ':completion:*:sudo:*' environ PATH="$SUDO_PATH:$PATH"

This will provide */sbin in path for commands prefaced with 'sudo'.

best ... khay
Back to top
View user's profile Send private message
dman777
l33t
l33t


Joined: 10 Jan 2007
Posts: 910

PostPosted: Mon Sep 03, 2018 8:00 pm    Post subject: Reply with quote

My user is already in the wheel group(also, su for this user works fine in bash, only zsh)

Code:
% id one
uid=1000(one) gid=1000(one) groups=1000(one),10(wheel),18(audio),27(video),100(users)


I added to ~/.zshrc the zstyle and the other if block in /etc/zprofile. But sudo still complains about my user not being allowed as root on local host.
_________________
<h5>Checkout <em>#grandmasboy</em> on <em>freenode</em>...chat with jayP bot from the movie!</h5>
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6229
Location: Room 101

PostPosted: Mon Sep 03, 2018 9:03 pm    Post subject: Reply with quote

dman777 ...

that output doesn't come from zsh but from the command ... but I don't understand why zsh would behave any differently to bash ITR. What did you do in terms of "using the gentoo zsh wiki", did you install oh-my-broken-zsh? What happens if you do the following:

Code:
% zsh -f
% su -

and/or
Code:
% env -i zsh -f
% su -

best ... khay
Back to top
View user's profile Send private message
dman777
l33t
l33t


Joined: 10 Jan 2007
Posts: 910

PostPosted: Thu Sep 06, 2018 1:52 am    Post subject: Reply with quote

No, I am staying away from oh my zsh

Both of those options worked. Any idea what could be wrong?


Code:
one@localhost ~/gitlab/front-end-dolphin-upgrade (polymer-3-attempt)
% zsh -f
localhost% su -
Password:
localhost ~ #

_________________
<h5>Checkout <em>#grandmasboy</em> on <em>freenode</em>...chat with jayP bot from the movie!</h5>
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6241

PostPosted: Thu Sep 06, 2018 4:48 am    Post subject: Reply with quote

dman777 wrote:
Any idea what could be wrong?

If zsh -f is working something is broken in either /etc/zsh/* or ~/.z*
There might be e.g. an assignment to one of the "magic" variables UID, USER, EUID, ...
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6229
Location: Room 101

PostPosted: Thu Sep 06, 2018 9:40 am    Post subject: Reply with quote

dman777 ...

as mv pointed out, it's a configuration issue, can you pastbin your ~/.zshrc, ~/.zprofile, etc.

Also, you should probably set a hostname, as per the handbook.

best ... khay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum