I am using the new Azure Active Directory ("AAD") Login mechanism to log in to Azure Ubuntu Linux VMs in my Azure environment, and I'd like to change the default shell for my user. The thing you'd normally do with chsh -s
. chsh is not working for me, and I'm wondering what I'm supposed to do instead in this case. Does anybody know how to change the default shell for an AAD-authentication account on a Linux VM
I, and some of the other users at my work, would like to change their default shell to be zsh instead of bash, because we like zsh better for interactive use.
Here's what I see when I try to use chsh -s
(redacted).
[email protected]@my-linux-box:~/repos$ whoami
[email protected]
[email protected]@my-linux-box:~/repos$ which zsh
/usr/bin/zsh
[email protected]@my-linux-box:~/repos$ grep zsh /etc/shells
/bin/zsh
/usr/bin/zsh
[email protected]@my-linux-box:~/repos$ chsh -s /usr/bin/zsh
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code *****AXTVTGR5F***** to authenticate.
When you sign in, verify the name of the app on the sign-in screen is "Azure Linux VM Sign-in" and the IP address of the VM is correct.
chsh: user '[email protected]' does not exist in /etc/passwd
[email protected]@my-linux-box:~/repos$ grep janke /etc/passwd
[email protected]@my-linux-box:~/repos$
[email protected]@lx-dev-01:~/repos$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"
This is a Linux VM on Azure created from either the "Ubuntu Server 20.04 LTS" image and then upgraded with do-release-upgrade
, or created from the "Ubuntu Server 22.04 LTS" image; I can't remember which.
If I were using OpenLDAP, there's a place in the LDAP directory to set a default shell on a per-user basis. But I don't see anything like that in Azure Active Directory.
I am using the "new" Azure AD Authentication for Linux mechanism described here - https://learn.microsoft.com/en-us/azure/active-directory/devices/howto-vm-sign-in-azure-ad-linux - and not the old, deprecated one described here - https://learn.microsoft.com/en-us/previous-versions/azure/virtual-machines/linux/login-using-aad. The "device login" dialog shown above is in response to a chsh
on the remote Linux VM, not part of an interactive-keyboard login process used to SSH in to that box in the first place.
I do not want to do the sloppy hack where you just throw an exec zsh
call at the bottom of your ~/.bashrc
file. If you do that, then it's hard to run an interactive bash, and we have reasons to do that for testing and code sharing and whatnot, even if we prefer to use zsh for most interactive shell scenarios.