|Front | Info | Lists | Newsfeeds | Study Guide | What is BSD?|
This is the BSDA Study Guide Book written via a wiki collaboration. This is a work in progress. You may contribute to or discuss this specific page at http://bsdwiki.reedmedia.net/wiki/Change_a_user__39__s_default_shell.html.
Change a user's default shell
Know the default shells for both user accounts and the superuser account for each BSD. In addition, know how to change the default shell for each BSD operating system.
BSD systems historically use the standard C shell (/bin/csh) as root's login shell. OpenBSD uses /bin/ksh for root's shell.
TODO: should C shell be spelled out? Or called Csh? or csh?
If no shell is set (the 7th field in the passwd database is empty), then login and some other programs will default to standard /bin/sh.
Many system users use /sbin/nologin as the default shell. This utility will simply exit after outputting "This account is currently not available." (Note: On FreeBSD, the nologin(8) utility is located at /usr/sbin/nologin.)
The standard tool for changing the user's login shell is chsh(1). (It is a link to chpass(1).) Running the chsh utility will start up your preferred editor where the user can modify the selected shell (and other user database information).
The chsh program is setuid root, so it runs with root's privilege so it can modify the user databases. TODO: should this setuid be noted here?
TODO: should this cover EDITOR or VISUAL here? Or point to which topic page?
TODO: what systems don't default to vi for VISUAL or EDITOR??
The vipw tool can also be used to manually edit the master.passwd database and related user databases. See section Protect authentication data for details.
TODO: show how to use chsh from command line without using editor. Do all BSDs support that?
TODO: show how to use pw (FreeBSD and DragonFly) to set shell and show how to use "usermod" (NetBSD and OpenBSD) for this. Or maybe not as is covered in another section.
TODO: point to section Create, modify and remove user accounts and 'Lock a user account or reset a locked user account. Put these four sections next to each other in book
vipw(8); chpass(1), chfn(1), chsh(1), pw(8), user(8)