diff -Nur e-smith-base-5.6.0/root/etc/e-smith/events/actions/init-accounts e-smith-base-5.6.0_bz8549/root/etc/e-smith/events/actions/init-accounts --- e-smith-base-5.6.0/root/etc/e-smith/events/actions/init-accounts 2014-03-24 03:47:24.000000000 +0100 +++ e-smith-base-5.6.0_bz8549/root/etc/e-smith/events/actions/init-accounts 2014-11-02 22:49:34.550000000 +0100 @@ -30,7 +30,29 @@ my $conf = esmith::ConfigDB->open_ro or die "Could not open Config DB"; -my $ldapauth = $conf->get('ldap')->prop('Authentication') || 'disabled'; +system(qw(/usr/sbin/groupadd -g 102 -r -o -f apache)) + unless getgrnam("apache"); + +# Make sure apache exist and has the same uid/gid as www +if ( !getpwnam("apache") ) +{ + die "Error creating apache user or group" unless ( + system(qw(/usr/sbin/groupadd -g 102 -o apache)) == 0 && + system(qw(/usr/sbin/useradd -u 102 -g 102 -o -c 'Apache' -d /var/www -M -s /bin/nologin apache)) == 0 + ); +} +else +{ + my $id = `/usr/bin/id -u apache`; + chomp($id); + if ( $id ne '102') + { + die "Error changing apache uid or gid" unless ( + system(qw(/usr/sbin/groupmod -g 102 -o apache)) == 0 && + system(qw(/usr/sbin/usermod -u 102 -g 102 -o apache)) == 0 + ); + } +} # fix permissions for www and apache warn "failed to fix permissions for www" unless (