The default shell in FreeBSD is sh and I really can't stand it: autocomplete is very limited, and rehash commands kill me. I feel like a one armed and one legged man...

How can I change the shell globally to zsh or bash - for root and for all current and future users?

  • 1
    Just tried this to update an existing user in FreeBSD 9.1 and the system prompted me to use the following: chpass -s /usr/local/bin/bash USER – commbot Feb 26 '13 at 7:18

For existing users, use the chsh command (“change shell”):

chsh -s SHELL USER
chsh -s /usr/local/bin/bash root

For future users:

  • Edit "/etc/pw.conf" defaultshell keywords
  • When use adduser(), choose necessary shell
  • 15
    ...but be careful about changing the root shell to something from the ports tree (e.g., /usr/local/bin/bash), because if you screw something up during a port upgrade you may find yourself without root access. – larsks Jan 29 '11 at 14:50
  • 2
    s/feature/future/? – Paused until further notice. Jan 29 '11 at 14:58
  • larsk: zsh can be build statically right..? [at least I saw parameter in "make config"] so as far as I understand, it's a binary with all dependencies build in? so can I put /usr/local/bin/zsh to /bin/zsh ? root user can use old version it's ok.. then it would be safe? – holms Jan 29 '11 at 15:27
  • 8
    Building it statically and copying it into /bin is probably the safest thing you can do. I just leave root's shell set to /bin/sh and then exec bash on those rare occasions when I really need to log in as root (more often I just use sudo from my user account). – larsks Jan 29 '11 at 15:33
  • Note this must be run as root (or with sudo). – Sopalajo de Arrierez Jan 7 '16 at 1:24

protected by Community Jul 27 '18 at 12:11

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.