Change default shell: Difference between revisions

From Alpine Linux
(correct GECOS field)
(added links to busybox and ash shell)
Line 1: Line 1:
{{Note|By default Alpine Linux uses the busybox variant of the [https://en.wikipedia.org/wiki/Almquist_shell ash] shell, but many users may prefer {{Pkg|bash}}, {{Pkg|zsh}}, {{Pkg|fish}}, or another shell.}}
Alpine Linux uses the [[BusyBox]] variant of the [[BusyBox#Ash_shell|ash]] shell. This page explains various ways to change the default shell in Alpine Linux to other popular shells like {{Pkg|bash}}, {{Pkg|zsh}}, {{Pkg|fish}} etc..
 
== By hand ==
== By hand ==
Edit {{Path|/etc/passwd}} manually. An example line for a user named <code>user</code> is:
Edit {{Path|/etc/passwd}} manually. An example line for a user named <code>user</code> is:
Line 24: Line 25:
[[Category:Shell]]
[[Category:Shell]]
[[Category:Newbie]]
[[Category:Newbie]]
[[Category:System Administration]]

Revision as of 17:57, 21 October 2024

Alpine Linux uses the BusyBox variant of the ash shell. This page explains various ways to change the default shell in Alpine Linux to other popular shells like bash, zsh, fish etc..

By hand

Edit /etc/passwd manually. An example line for a user named user is:

Contents of /etc/passwd

... user:x:1000:1000:user:/home/user:/bin/ash ...

Change /bin/ash to point to the path of a shell from /etc/shells. Take care to not delete/mangle the line, as it would make you unable to log in again. The user should be the user you are changing the default login shell for.

Using shadow

Download the required package:

# apk add shadow

And use chsh:

# chsh username

Now enter the path for the shell you want to use (e.g /bin/bash) and press Enter to confirm this change. The shell should exist in /etc/shells.

Note: You may need to log out or reboot for this change to take effect, ash is part of busybox so you can revert back to ash (/bin/ash) at anytime with the same steps.