diff options
author | Andrea Righi <andrea.righi@canonical.com> | 2020-11-02 12:05:24 +0100 |
---|---|---|
committer | Andrea Righi <andrea.righi@canonical.com> | 2020-11-02 12:23:58 +0100 |
commit | bd1d869920767216b39ac02f31acd4e78b535af0 (patch) | |
tree | 5872536e66546fd3e7aa2b177c926d68b178312e | |
parent | 88cd30f073714bd097d83bc7a6b028c0e4bf7a2b (diff) | |
download | virtme-bd1d869920767216b39ac02f31acd4e78b535af0.tar.gz |
virtme-init: generate dummy /etc/shadow
Trying to switch to any non-root user from a virtme environment returns
the following error:
su: Authentication failure
Populate dummy entries in /etc/shadow to allow switching to any user
defined in the system.
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
-rwxr-xr-x | virtme/guest/virtme-init | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/virtme/guest/virtme-init b/virtme/guest/virtme-init index 56226d3..1c4653c 100755 --- a/virtme/guest/virtme-init +++ b/virtme/guest/virtme-init @@ -46,6 +46,13 @@ touch /tmp/fstab mount --bind /tmp/fstab /etc/fstab rm /tmp/fstab +# Populate dummy entries in /etc/shadow to allow switching to any user defined +# in the system +touch /tmp/shadow +chmod 0640 /tmp/shadow +sed -e 's/^\([^:]\+\).*/\1:x:::::::/' < /etc/passwd > /tmp/shadow +mount --bind /tmp/shadow /etc/shadow + # Find udevd if [[ -x /usr/lib/systemd/systemd-udevd ]]; then udevd=/usr/lib/systemd/systemd-udevd |