diff options
| author | Marco Amadori <amadorim@vdavda.com> | 2008-09-02 10:42:11 +0200 |
|---|---|---|
| committer | Daniel Baumann <daniel@debian.org> | 2011-03-09 17:48:02 +0100 |
| commit | 2910ae281a07441f55215ca74ec38f1d499420f2 (patch) | |
| tree | e4caef960a7e770fe9ae0078ef3962f1264bd11c /scripts/live-bottom/10adduser | |
| parent | c8143167a7af7f3ff8c138f52c4ac637fd6c9312 (diff) | |
| download | live-boot-2910ae281a07441f55215ca74ec38f1d499420f2.tar.gz live-boot-2910ae281a07441f55215ca74ec38f1d499420f2.zip | |
Fix default user handling.
* Handle the case in which an user is present but the default user could not
be created (e.g. when configuring another user at build time in the
chroot). If the default user could not be created or assigned, disable
autologins (which previously just fails leaving without console login
capabilities), and propagate that information to the scripts thinking that a
default user will always be available.
Note for live-helper documentation: The latter case could leave the system
accessible only if root password is set in other ways or via ssh rsa/dsa
passwordless accesses.
Diffstat (limited to 'scripts/live-bottom/10adduser')
| -rwxr-xr-x | scripts/live-bottom/10adduser | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/live-bottom/10adduser b/scripts/live-bottom/10adduser index 7498476..4c0fe80 100755 --- a/scripts/live-bottom/10adduser +++ b/scripts/live-bottom/10adduser @@ -58,6 +58,28 @@ set passwd/username set passwd/user-uid EOF +if ! grep "${USERNAME}" /root/etc/passwd +then + echo "The default user (${USERNAME}) is not present," + first_user=$(grep '^[^:]*:[^:]*:[12]\?[0-9][0-9][0-9][0-9]:' /root/etc/passwd | head -1 | cut -f1 -d ':') + if [ -n "${first_user}" ]; + then + echo "setting default user to: ${first_user}." + USERNAME="${first_user}" + really_export USERNAME + else + echo "no other valid users found, disabling autologin." + NOAUTOLOGIN="Yes" + NOXAUTOLOGIN="Yes" + USERNAME="" + really_export NOAUTOLOGIN + really_export NOXAUTOLOGIN + really_export USERNAME + log_end_msg + exit 0 + fi +fi + if [ -z "${NOSUDO}" ] then if ! grep -q "${USERNAME}" /root/etc/sudoers |
