I use a samba4 domain account to log in on my laptop. I wanted to try zsh out, but since my user doesn't reside in /etc/passwd I found that chsh can't find my user. Can anyone advise how I can change my login_shell?

I couldn't see anything in my ldap.conf, nssswitch.conf or anything in /etc/pam.d that helped...

Looking on the domain controller I thought maybe I could use samba-tool, but I saw nothing in help that pointed me in the right direction...

3 Answers
3

I asked about this in the #suse channel on Freenode, and Miuku suggested the same as Arul, however, he mentioned two things, if I were using a Windows domain I could set the loginShell attribute.

Sadly, I'm on a samba domain, so that didn't help. But his final suggestion was perfect, get the output of:

getent passwd USERNAME

This will have the valid entry equivalent for your user in /etc/passwd, take this, paste it in to /etc/passwd and update the shell at the end for the valid path of the shell you want to use. This way it doesn't change it for all users, and you can make sure that shell is on the machine you're configuring this on before making the change.

If you don't want to copy and paste, you can use: getent passwd `id -un` | sudo tee -a /etc/passwd. Not sure if it works in all shells but at least bash and tcsh are ok.
– Tom SaleebaFeb 21 '18 at 4:07

Doing this on a RHEL 7 box connected to a Windows AD domain caused me to be locked out of the server until the line was removed from the /etc/passwd file...
– TaegostDec 20 '18 at 21:38

Thanks for the info @Taegost, I hadn't tried on RHEL
– RumblesDec 24 '18 at 11:52

Someone at my work was doing something similar recently, he had issues with his method not loading the .zshrc file. I don't know if your method would work in that respect, have you tried it? Also, your SHELL variable isn't the same as the path to your zsh bin, is that correct? I changed their config to my method of setting it in the passwd file
– RumblesFeb 15 '18 at 10:18

Well it's definately one way of doing it, I still prefer to set it in the /etc/passwd file as with my accepted answer as you don't invoke bash then load zsh with bash (plus I guess if you press ctrl-D in your setup you are dropped to a bash shell?) - It does require the user to ensure you have zsh installed and for an admin to make the change
– RumblesFeb 15 '18 at 13:21

Wouldn't it be better, instead of using /usr/bin/zsh, to instead use exec /usr/bin/zsh to replace the bash shell process with the zsh shell process?
– Tripp KineticsAug 27 '18 at 21:06

I think you may be right @TrippKinetics.
– Matteo GianiAug 31 '18 at 10:53

Thanks, but won't that affect all users, not just mine?
– RumblesNov 15 '15 at 14:14

Yes, it is a global parameter that affects all users. In this case, all users who have zsh installed. I am not sure you can restrict this to specific user but I would check idmap uid parameter which might allow you to do that.
– Arul SelvanNov 15 '15 at 14:56

Thanks, but that's not what I'm after. I don't want to change everyone shell, I just want to change my shell. I tried changing this setting in my local smb.conf and after rebooting it had no effect
– RumblesNov 16 '15 at 9:47