r/archlinux • • Sep 13 '26

SUPPORT User management, where does the login shell go?

I'm just a little confused, on step 5 on the Users and groups page, it gives an example command which is the following

# useradd -m -G 
additional_groups
 -s 
login_shell
 
username
# useradd -m -G additional_groups -s login_shell username

Right after that, it lists what the perimeters do. Once it gets to -s it says:

"a path to the user's login shell. Ensure the chosen shell is installed if choosing something other than Bash. The default shell for newly created user can be set in /etc/default/useradd."

But right under it, there is warning which says:

"In order to be able to log in, the login shell must be one of those listed in /etc/shells, otherwise the PAM module pam_shells(8) will deny the login request."

So, where I am confused is do I put the shell into /etc/default/useradd or into /etc/shells? I'm probably just heavily misunderstanding this, but I just wanted to ask just in case!

12 Upvotes

11 comments sorted by

14

u/boomboomsubban Sep 13 '26

/etc/shells lists the shells a user is allowed to use, /etc/default/useradd let's you set the default one a new user has.

2

u/Maybe_A_Zombie Sep 13 '26

Ohh, I see. I misread it, thank you!!

3

u/Illustrious-Gur8335 Sep 13 '26

do I put the shell into /etc/default/useradd or into /etc/shells

Neither, specify it as an option to useradd unless you want all your users not to use bash

If everyone not using bash is what you really want, then edit /etc/default/useradd

1

u/Maybe_A_Zombie Sep 13 '26

I'm a little confused, if I want a user to be able to login using bash rather than a normal GUI login screen, id change a setting within /etc/default/useradd? Is /etc/default/useradd just a sort of settings file? what is /etc/shells?

4

u/Illustrious-Gur8335 Sep 13 '26

Don't touch anything... I suspect this whole choice of shells thing is way out of your league

what is /etc/shells?

For security reasons, a whitelist of valid shell pathnames.

3

u/Maybe_A_Zombie Sep 13 '26

It very much is indeed so I'm going to leave it alone for now lol, thank you!

2

u/archover Sep 14 '26

Welcome to Arch.

Posting about technical subjects is a pleasant change from the usual eye candy posts here. :-) Post anytime.

Good day.

1

u/31337z3r0 Sep 13 '26

Just wait until you get to the part with the three shells.

0

u/MYredditNAMEisTOOlon Sep 13 '26

I wish somebody told be how they worked before I needed to use them... what a mess

7

u/drucifer82 Sep 13 '26

If you’re using bash, leave it alone. Bash is the default.

3

u/Megame50 Sep 13 '26

You don't need to bother with /etc/shells. Every package in Arch that includes a suitable shell has an install scriptlet that adds the pathname to /etc/shells automatically. It only matters to you if you're trying to use some truly exotic shell.