How do I change my default shell on a domain account

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...


Solution 1:

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.

Solution 2:

I had exactly the same issue. Since not all machines in my domain have zsh installed, and since I did not want to affect all users, I ended up putting in my .bashrc:

if [ -x /usr/bin/zsh ]; then
  echo 'starting zsh'
  # export SHELL=/bin/zsh #edit: this is probably not what you want, see the comment.
  exec /usr/bin/zsh
fi

This might be inelegant, but at least it gets the job done.

Solution 3:

If you have access to edit the samba domain controller config, you can set the following property that allows you to set the shell in smb.conf

template shell    = /bin/zsh

Not sure what happens if you login to a machine that does not have zsh installed (not all distros have zsh installed by default), but my guess is that it will invoke distro default shell.

If you simply want to try it, just type zsh to get a subshell which I am sure you know that already.