How to change default shell in FreeBSD?
24,740
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
Related videos on Youtube
Author by
sparcboy
Just a DevOps, who's passionate about scaling and automation. Who doesn't want to do less job anyway? DevOps practices brought a new way to decrease maintenance for the whole company, which is basically increase of profit up to 80% in some cases! My background is mostly Python with HA web services. Currently working with Kubernetes and Terraform.
Updated on September 17, 2022Comments
-
sparcboy over 1 year
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
orbash
- for root and for all current and future users?-
commbot about 11 yearsJust 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
-
-
user2751502 over 13 years...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.
-
Dennis Williamson over 13 yearss/feature/future/?
-
sparcboy over 13 yearslarsk: 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?
-
user2751502 over 13 yearsBuilding 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 thenexec bash
on those rare occasions when I really need to log in as root (more often I just usesudo
from my user account). -
Sopalajo de Arrierez over 8 yearsNote this must be run as root (or with
sudo
).