diff -up e-smith-base-5.4.0/root/etc/e-smith/events/actions/init-accounts.uidgid e-smith-base-5.4.0/root/etc/e-smith/events/actions/init-accounts --- e-smith-base-5.4.0/root/etc/e-smith/events/actions/init-accounts.uidgid 2013-03-06 12:08:29.100199464 -0700 +++ e-smith-base-5.4.0/root/etc/e-smith/events/actions/init-accounts 2013-03-06 12:26:27.173888310 -0700 @@ -35,11 +35,11 @@ my $ldapauth = $conf->get('ldap')->prop( # create group "shared" if not already present if ($ldapauth eq 'enabled') { - system(qw(/usr/sbin/cpu groupadd shared)) unless getgrnam("shared"); + system(qw(/usr/sbin/cpu -g 500 groupadd shared)) unless getgrnam("shared"); } else { - system(qw(/usr/sbin/groupadd -r shared)) unless getgrnam("shared"); + system(qw(/usr/sbin/groupadd -r -g 500 shared)) unless getgrnam("shared"); } # Create other required groups and users @@ -54,12 +54,12 @@ if ( !getpwnam("admin") ) { if ($ldapauth eq 'enabled') { - `/usr/sbin/cpu useradd -f 'e-smith' -E 'administrator' -d /home/e-smith -G shared -M -s /sbin/e-smith/console admin`; + `/usr/sbin/cpu useradd -u 101 -f 'e-smith' -E 'administrator' -d /home/e-smith -G shared -M -s /sbin/e-smith/console admin`; `/usr/bin/gpasswd -a admin root`; } else { - `/usr/sbin/useradd -c 'e-smith administrator' -d /home/e-smith -G root,shared -M -s /sbin/e-smith/console admin`; + `/usr/sbin/useradd -u 101 -c 'e-smith administrator' -d /home/e-smith -G root,shared -M -s /sbin/e-smith/console admin`; } } else @@ -135,15 +135,41 @@ if ( !getpwnam("www") ) { if ($ldapauth eq 'enabled') { - `/usr/sbin/cpu useradd -f 'e-smith' -E 'web server' -d /home/e-smith -G shared -M -s /bin/false www`; + `/usr/sbin/cpu useradd -u 102 -g 102 -f 'e-smith' -E 'web server' -d /home/e-smith -G shared -M -s /bin/false www`; } else { - `/usr/sbin/useradd -c 'e-smith web server' -d /home/e-smith -G shared -M -s /bin/false www`; + `/usr/sbin/useradd -u 102 -g 102 -c 'e-smith web server' -d /home/e-smith -G shared -M -s /bin/false www`; } } else { + my $uid = `/usr/bin/id -u www`; + chomp($uid); + my $gid = `/usr/bin/id -g www`; + chomp($gid); + if ( $uid ne '102' || $gid ne '102' ) + { + if ($ldapauth eq 'enabled') + { + die "Error changing www uid or gid" unless ( + system("/usr/sbin/cpu groupmod -g 102 www") == 0 && + system("/usr/sbin/cpu usermod -u 102 -g 102 www") == 0 + ); + } + else + { + die "Error changing www uid or gid" unless ( + system("/usr/sbin/groupmod -g 102 -o www") == 0 && + system("/usr/sbin/usermod -u 102 -g 102 -o www") == 0 + ); + } + warn "failed to fix permissions for www" unless ( + system("/bin/rpm --setugids horde imp-h3 ingo-h3 turba-h3 2> /dev/null") == 0 + ); + } + + #-------------------------------------------------- # www account already exists. Make sure that it is in groups "admin" # and "shared" without disturbing any other group memberships. @@ -208,7 +234,7 @@ else system("/usr/sbin/usermod -u 102 -g 102 -o apache") == 0 ); warn "failed to fix permissions for apache" unless ( - system("/bin/rpm --setugids httpd mod_auth_tkt mod_ssl php 2> /dev/null") == 0 + system("/bin/rpm --setugids httpd mod_auth_tkt mod_ssl php pwauth 2> /dev/null") == 0 ); } }