Currently the shell must be looked up from the config setting in
/etc/libvirt/virt-login-shell.conf. This is inflexible if there
are containers where different users need different shells. Add
add a new 'auto-shell' config parameter which instructs us to
query the containers' /etc/passwd for the shell to be exec'd.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Currently the shell config file parameter must be a list
giving the shell path and args. Allow it to be a plain
string argument as well.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Currently we request a login shell by passing the -l argument
to the shell. This is either hardcoded, or required to be
specified by the user in the virt-login-shell.conf file.
The standard way for login programs to request a shell run
as a login shell is to modify the argv passed to execve()
so that argv[0] contains the relative shell filename
prefixed with a zero. eg instead of doing
const char **shellargs = ["/bin/bash", "-l", NULL];
execve(shellargs[0], shellargs, env);
We should be doing
const char **shellargs = ["-bash", NULL];
execve("/bin/bash", shellargs, env);
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Add a virt-login-shell binary that can be set as a user's
shell, such that when they login, it causes them to enter
the LXC container with a name matching their user name.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>