Change default shell: Difference between revisions

From Alpine Linux
m (make dir info missed)
(Formatting improvements)
Line 1: Line 1:
==== Changing the default shell ====
{{Note|By default Alpine Linux uses the [https://en.wikipedia.org/wiki/Almquist_shell ash] shell, but many users may prefer {{Pkg|bash}}, {{Pkg|zsh}}, {{Pkg|fish}} or another shell.}}
<br>
Download the required package: <br>''apk add libuser''
<br>
If you do not have files: /etc/login.defs /etc/default/useradd
<br>
We will need to create them


* ''touch /etc/login.defs''
Download the required package:
* ''mkdir /etc/default''
{{Cmd|# apk add libuser}}
* ''touch /etc/default/useradd''
Create: <code>/etc/login.defs</code> and <code>/etc/default/useradd</code>, if you don't have them:
<br>
{{Cmd|# touch /etc/login.defs}}
Now we can change our default shell
{{Cmd|# mkdir /etc/default}}
<br>
{{Cmd|# touch /etc/default/useradd}}
If you want to change the current user's shell: lchsh
Change current USER's shell:
<br>
{{Cmd|# lchsh USER}}
If you want to change a different user's shell: lchsh USERNAME
 
Now enter the path for the shell you want to use (e.g <code>/bin/bash</code>)
and press enter to confirm this change.
 
{{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''' at anytime with the same steps.}}

Revision as of 09:42, 8 February 2022

Note: By default Alpine Linux uses the ash shell, but many users may prefer bash, zsh, fish or another shell.

Download the required package:

# apk add libuser

Create: /etc/login.defs and /etc/default/useradd, if you don't have them:

# touch /etc/login.defs

# mkdir /etc/default

# touch /etc/default/useradd

Change current USER's shell:

# lchsh USER

Now enter the path for the shell you want to use (e.g /bin/bash) and press enter to confirm this change.

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 at anytime with the same steps.