Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I change my shell to one installed in my home directory? I installed a new zsh in my home directory, which is picked up:

>> which zsh
>> /home/myname/bin/zsh

It's not listed in /etc/shells (and won't be, as I lack permission), so how do I install it?

chsh -s $(which zsh) myname
Changing shell for myname
chsh: "/home/myname/bin/zsh" is not listed in /etc/shells
chsh: use -l option to see list
share|improve this question

migrated from Feb 8 '12 at 2:06

This question came from our site for professional and enthusiast programmers.

marked as duplicate by ChrisF, Ƭᴇcʜιᴇ007, KronoS, 8088, Lance Roberts Mar 7 '13 at 17:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Perhaps you could exec zsh in your bashrc ? – cnicutar Feb 7 '12 at 21:50
@cnicutar That works, thanks, but seems a bit of a hack. Is the reason I can't do it properly because sysadmins don't want users to screw up their shells? – ash Feb 7 '12 at 21:53
I don't know the reasoning behind /etc/shells, do tell if you find out. – cnicutar Feb 7 '12 at 21:55
Ok, thanks. Can you make it an answer? I will accept it. – ash Feb 7 '12 at 21:59
See this answer for somewhat fail safe way to start zsh from bash – Francisco Mar 6 '13 at 8:15
up vote 3 down vote accepted

The whole point of /etc/shells is so that the administrator can control what users set as their shell. Setting a shell which isn't listed in /etc/shells would therefore be a security hole. The best solution is to ask the administrator to install zsh system wide, but if that's not possible your only option is configuring your current shell (I'm assuming bash) to execute your custom shell. You can do this by adding the following to ~/.bash_profile (this will only affect login shells, whereas ~/.bashrc will also affect non-login shells which may break scripts).

exec ~/bin/zsh
share|improve this answer
If you are on an administered system, and the system administrator says "no" to an installation of zsh, I would think twice - and definitely ask the admin for permission - before installing zsh locally. Call me paranoid, but asking first is definitely better than getting issued a warning notice for violating company policy... – DevSolar Jun 6 '12 at 7:27

Not the answer you're looking for? Browse other questions tagged .