Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFE: nologin: support -l, -i and --login parameters and ignore them #895

Closed
poettering opened this issue Nov 14, 2019 · 3 comments
Closed

Comments

@poettering
Copy link
Contributor

nologin is typically used in /etc/passwd as a shell replacement. Hence it would be great if it would accept and ignore some parameters that shells usually implement. Specifically: -l/--login, -i (for login/interactive shell), which bash, dash, zsh all implement.

Note that these options aren't POSIX definitions but practically all shells that I found implement them. Hence nologin should probably too.

I figure nologin should just eat up these switches and do the very same thing it would normally do.

This would help to make this more explanatory:

systemd/systemd#8634

we currently invoke the listed shell of the user specified in "machinectl shell myuser@mycontainer" and then you get an ugly error, about "-l" not being accepted. Would be nice to get a nicer error that just says login not permitted.

(Yes I am aware we could also set argv[0][0]='-' when invoking the shell, to get a login shell in a way compatible with nologin, but that's hard to do if you only have POSIX shell for that.)

kerolasa added a commit to kerolasa/util-linux that referenced this issue Nov 14, 2019
nologin is typically used in /etc/passwd as a shell replacement.  Hence
ignore all unknown options and arguments silently to avoid unwanted ugly
error messages.

Addresses: util-linux#895
Requested-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
@kerolasa
Copy link
Member

It might be easiest to ignore unknown options, for example this way: #896

@poettering
Copy link
Contributor Author

(well, that's up to the maintainers, how they want that implemented; ignoring them all would work for me too, but I personally don't want to hide error conditions to agressively, so i'd just ignore the ones known to be used and still print errors for the others...)

kerolasa added a commit to kerolasa/util-linux that referenced this issue Nov 17, 2019
nologin is typically used in /etc/passwd as a shell replacement.  Hence it
is reasonable to ignore well known command-line options silently to avoid
unwanted ugly error messages.

Addresses: util-linux#895
Requested-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
kerolasa added a commit to kerolasa/util-linux that referenced this issue Nov 17, 2019
nologin is typically used in /etc/passwd as a shell replacement.  Hence it
is reasonable to ignore well known command-line options silently to avoid
unwanted ugly error messages.

Addresses: util-linux#895
Requested-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
@karelzak
Copy link
Collaborator

Merged.

amore17 added a commit to amore17/freeipa that referenced this issue Dec 10, 2020
/sbin/nologin fails with no such option on RHEL
Related : util-linux/util-linux#895

Signed-off-by: Anuja More <amore@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants