You are not logged in.

#26 2013-07-08 19:07:51

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Cant change shell for user (zsh)

Such configuration tools usually need sudo ... even though I successfully used chsh w/o sudo <shrugs>


Is your user really called 'user'? What's the output of 'whoami'?

Offline

#27 2013-07-08 19:18:32

Suami777
Member
Registered: 2013-07-07
Posts: 46

Re: [SOLVED] Cant change shell for user (zsh)

no no i just type in place my username "user" smile

Offline

#28 2013-07-08 19:59:02

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Cant change shell for user (zsh)

Please remember to mark the thread as solved https://bbs.archlinux.org/viewtopic.php?id=130309

Offline

#29 2013-07-08 20:05:49

Suami777
Member
Registered: 2013-07-07
Posts: 46

Re: [SOLVED] Cant change shell for user (zsh)

done wink

Offline

#30 2013-07-08 20:14:12

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Cant change shell for user (zsh)

What do you get (in terms of permissions) if you do

$ ls -l $(which chsh) 

You should get "-rwsr-wr-w" as that command requires the sticky bit to be set to use it as a normal user.  Even if you do get the same output as my example there, if you have the partition mounted with "nosuid", then these bits will not take effect.

Offline

#31 2013-07-08 20:19:04

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Cant change shell for user (zsh)

Not sure if this question is for me or for OP :-)

$ ls -l $(which chsh) 
-rwsr-xr-x 1 root root 18292 May 30 14:56 /usr/bin/chsh
$ chsh -s /usr/bin/zsh
Changing shell for karol.
Password: 
Shell changed.
$ type chsh
chsh is hashed (/usr/bin/chsh)

I do need 'sudo' to e.g. install stuff with pacman.

I don't use 'nosuid' for my regular partitions although it's used for cgroup, tmpfs and the like.

Offline

#32 2013-07-08 20:22:46

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Cant change shell for user (zsh)

Oh it was for the OP.  It was just in case he actually wanted to get to the bottom of why chsh only worked as root.  Those possibilities just came to mind as being problematic.

Offline

#33 2013-07-08 20:37:25

Suami777
Member
Registered: 2013-07-07
Posts: 46

Re: [SOLVED] Cant change shell for user (zsh)

-rwsr-xr-x 1 root root 19360 05-30 14:55 /usr/bin/chsh

Last edited by Suami777 (2013-07-08 20:37:49)

Offline

#34 2013-07-08 21:12:02

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Cant change shell for user (zsh)

... and mount options?

$ awk '5== "/"' /proc/self/mountinfo

Offline

#35 2013-07-08 21:17:18

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] Cant change shell for user (zsh)

WonderWoofy wrote:

... and mount options?

$ awk '$5== "/"' /proc/self/mountinfo

Fixed that for you smile


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#36 2013-07-09 00:28:48

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Cant change shell for user (zsh)

Thanks jasonwryan.

Offline

#37 2013-07-09 11:39:57

Suami777
Member
Registered: 2013-07-07
Posts: 46

Re: [SOLVED] Cant change shell for user (zsh)

19 1 8:3 / / rw,relatime shared:1 - ext4 /dev/sda3 rw,data=ordered

btw do you have maybe some webiste how to make themes for zsh ?

Offline

#38 2013-07-09 13:26:10

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,589

Re: [SOLVED] Cant change shell for user (zsh)

You could have easily googled that yourself, but here you go.)

Offline

#39 2013-07-09 15:29:57

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Cant change shell for user (zsh)

Suami777 wrote:
19 1 8:3 / / rw,relatime shared:1 - ext4 /dev/sda3 rw,data=ordered

btw do you have maybe some webiste how to make themes for zsh ?

Alright, I'm officially out of ideas... sorry.

What do you mean by "themes"?  Are you talking about the prompt?

Offline

#40 2013-07-09 18:11:42

kolos
Member
Registered: 2010-05-15
Posts: 57

Re: [SOLVED] Cant change shell for user (zsh)

I just had the same problem, somehow it worked when i closed X (openbox) and did it on tt1.


och noes!

Offline

#41 2013-07-09 20:34:19

Suami777
Member
Registered: 2013-07-07
Posts: 46

Re: [SOLVED] Cant change shell for user (zsh)

qinohe wrote:

You could have easily googled that yourself, but here you go.)

haha thanks wink but i mean can someone recommend me some webiste big_smile

Offline

#42 2014-07-02 13:46:43

Jacka
Member
From: Paris
Registered: 2014-07-02
Posts: 28

Re: [SOLVED] Cant change shell for user (zsh)

That disnt work for me, and i have no idea why.

$ chsh -s $(which zsh)
password:
shell changed.
  [ ... ]
$ echo $SHELL
/bin/bash

And "sudo chsh" changed the shell for root. For whom it worked perfectly, both with sudo or su...

I don't know how to make chsh work, but i used a trick.
At the very begining of your .bashrc file, add the following line :

~/.bashrc
----------------------------------------------------------------
/usr/bin/zsh ; exit

So the terminal will beging by launching zsh, and will exit with it.

I hope i helped. I m still interested in a "clean" way of doing it.

Last edited by Jacka (2014-07-03 10:41:50)

Offline

#43 2014-07-02 15:23:20

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Cant change shell for user (zsh)

Jacka wrote:

That disnt work for me, and i have no idea why.

$ chsh -s $(which zsh)
password:
shell changed.
  [ ... ]
$ echo $SHELL
/bin/bash

If this is actually all you did, then it makes sense why you would think it did not work.  You would need to log out and then back in again in order for this change to complete.  It might also be that your chsh binary doesn't have the proper permissions in order for this to work properly.  It needs to have the sticky bit set for the user in order to write to /etc/passwd when called as a normal user.

Can you try doing sudo chsh -s /bin/zsh jacka instead?  This will guarantee that chsh has proper write access to /etc/passwd.  You should probably also check /etc/passwd to make sure that it is being written to your user's line.

And "sudo chsh" changed the shell for root. For whom it worked perfectly, both with sudo or su...

I don't know how to make chsh work, but i used a trick.
At the very begining of your .bashrc file, add the following line :

~/.bashrc
----------------------------------------------------------------
/usr/bin/zsh && exit

So the terminal will beging by launching zsh, and will exit with it.

I hope i helped. I m still interested in a "clean" way of doing it.

I think in the case of sudo and su, this works because you are actually creating a new login upon every call of sudo or su.  So from your normal user's login, when you do 'sudo chsh -s /bin/zsh' it is changing the root users shell.  When you call sudo again, it is as though it is logging in a whole separate time.  (either that or my second theory on the sticky bit being not set is true)

I would avoid unnecessarily calling /usr/bin/zsh in your .bashrc if possible.  To me it doesn't really seem like a "clean" way of doing things.

Last edited by WonderWoofy (2014-07-02 15:23:59)

Offline

#44 2014-07-03 10:41:24

Jacka
Member
From: Paris
Registered: 2014-07-02
Posts: 28

Re: [SOLVED] Cant change shell for user (zsh)

  • My way doesn't seem "clean" to me either, that is why i said i am still interested in new posts.

  • I did logout-login as it was said in previous posts, my bad for being unclear.

  • I agree with your sudo-theory.

  • "sudo chsh -s /bin/zsh jacka" had no effetcs : it said "chsh: Shell not changed.", because it thinks it is zsh yet. $SHELL is still /bin/bash though.

I edited my previous post. I came up using ";" rather than "&&" in bashrc so bash would exit even if zsh had errors.

Thank you for your answer.

Offline

#45 2014-07-03 10:52:01

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,531
Website

Re: [SOLVED] Cant change shell for user (zsh)

If you have root access, you can just manually change the shell by editing /etc/passwd (preferably with vipw).


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Online

#46 2014-07-06 08:23:32

Jacka
Member
From: Paris
Registered: 2014-07-02
Posts: 28

Re: [SOLVED] Cant change shell for user (zsh)

Weird thing : I used "sudo vipw" to edit the file. But in it, it is written my shell is already zsh, at /bin/zsh !
So i deleted the "/bin/zsh" line in bashrc to see what would appen, and my shell was indeed zsh !

Maybe chsh needs to close every shell of the user, including the Xorg session ? In that case, the best thing would be to reboot after chsh.
That's a mystery. But it worked, thank you !

Offline

#47 2014-07-06 20:09:16

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Cant change shell for user (zsh)

@Jacka, as I mentioned before, you need to log out and then back in...

Offline

#48 2014-07-07 07:03:02

Jacka
Member
From: Paris
Registered: 2014-07-02
Posts: 28

Re: [SOLVED] Cant change shell for user (zsh)

@WonderWoofy, As i mentionned before, i did log out, and then back in.

Jacka wrote:
  • I did logout-login as it was said in previous posts, my bad for being unclear.

I think i had to close every terminal open i had, including my Xorg session.

Offline

#49 2024-09-16 16:15:36

JiangHuDao
Member
Registered: 2024-09-04
Posts: 2

Re: [SOLVED] Cant change shell for user (zsh)

First
```chsh -s /bin/zsh```
Then
```chsh -s /usr/bin/zsh```
Can solve my error(chsh: Shell not changed.)

Offline

#50 2024-09-16 16:25:45

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,208

Re: [SOLVED] Cant change shell for user (zsh)

Please don't necrobump 10 year old solved threads, make a new one if you actually still have an issue.

Closing.

Offline

Board footer

Powered by FluxBB