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: Custom shell for container user #211

Closed
seandilda opened this issue Jan 2, 2020 · 5 comments
Closed

RFE: Custom shell for container user #211

seandilda opened this issue Jan 2, 2020 · 5 comments

Comments

@seandilda
Copy link

Would it be possible to add an option specifying what shell is added in /etc/passwd for the new container user? I'm using x11docker to launch a different terminal, but I end up stuck with /bin/sh as my shell. It'd be wonderful if I could pass a path on the command line to use instead.

@mviereck
Copy link
Owner

mviereck commented Jan 2, 2020

In my tests I found that environment variable SHELL supersedes the setting in /etc/passwd. It should work if you set e.g. --env SHELL=/bin/zsh.

x11docker sets SHELL=/bin/bash if available, otherwise it sets SHELL=/bin/sh. https://github.com/mviereck/x11docker/blob/master/x11docker#L5488

Please try out if that works for you.

@seandilda
Copy link
Author

When I use xterm, I see the behavior you describe. When I use terminator, the $SHELL value is ignored and /etc/passwd is used instead.

terminator does allow me to specify an alternative shell, so I do have a workaround. However, I thought it might be a generally useful feature to allow an alternative shell for the container.

@mviereck
Copy link
Owner

mviereck commented Jan 2, 2020

When I use xterm, I see the behavior you describe. When I use terminator, the $SHELL value is ignored and /etc/passwd is used instead.

Indeed, I can confirm that.
I checked xfce4-terminal, it ignores SHELL, too. gnome-terminal regards it. This seems to be inconsistent across several terminals.

I once rejected a pull request for this: #26
I wanted to avoid a growing number of options. Now I consider to add a --shell option because setting SHELL does not work reliable.

Imho terminals should regard SHELL and should get a bug report if they don't.
POSIX says:

SHELL
This variable shall represent a pathname of the user's preferred command language interpreter.

@mviereck
Copy link
Owner

mviereck commented Jan 2, 2020

I've added a new option --shell. Something like --shell=/bin/zsh should work now.
If your preferred shell is bash and has been set wrong by terminator before, it should be set automatically now without the need of --shell.

@seandilda
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants