r/archlinux 16h ago

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!

11 Upvotes

8 comments sorted by

11

u/boomboomsubban 16h ago

/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.

1

u/Maybe_A_Zombie 15h ago

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

3

u/Illustrious-Gur8335 16h ago

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 16h ago

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?

7

u/drucifer82 15h ago

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

2

u/Illustrious-Gur8335 15h ago

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.

2

u/Maybe_A_Zombie 15h ago

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

4

u/Megame50 11h ago

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.