Currently, chsh will check whether the shell is listed in /etc/shells for non-root users but not for root.
|
if ( !amroot |
|
&& ( is_restricted_shell (loginsh) |
|
|| (access (loginsh, X_OK) != 0))) { |
|
fprintf (stderr, _("%s: %s is an invalid shell\n"), Prog, loginsh); |
|
fail_exit (1); |
|
} |
|
|
|
/* Even for root, warn if an invalid shell is specified. */ |
|
if (access (loginsh, F_OK) != 0) { |
|
fprintf (stderr, _("%s: Warning: %s does not exist\n"), Prog, loginsh); |
|
} else if (access (loginsh, X_OK) != 0) { |
|
fprintf (stderr, _("%s: Warning: %s is not executable\n"), Prog, loginsh); |
|
} |
|
|
This may lead to a login failure when, for example, user sets shell to /bin/bash instead of /usr/bin/bash, which the former is not listed in /etc/shells. chsh should warn user that the possible invalid shell is provided.
An expected behavior is to warn the root user that Warning: $SHELL is not present in /etc/shells.
Currently,
chshwill check whether the shell is listed in/etc/shellsfor non-root users but not for root.shadow/src/chsh.c
Lines 517 to 530 in 1f84142
This may lead to a login failure when, for example, user sets shell to
/bin/bashinstead of/usr/bin/bash, which the former is not listed in/etc/shells.chshshould warn user that the possible invalid shell is provided.An expected behavior is to warn the root user that
Warning: $SHELL is not present in /etc/shells.