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 2015-01-03 20:30:14.270708139 +0100 @@ -30,7 +30,33 @@ my $conf = esmith::ConfigDB->open_ro or die "Could not open Config DB"; -my $ldapauth = $conf->get('ldap')->prop('Authentication') || 'disabled'; +#create the group apache if doesn't exist +system(qw(/usr/sbin/groupadd -g 102 -r -o -f apache)) + unless getgrnam("apache"); + +# create the user apache if doesn't exist and has not the same uid/gid as www +if ( !getpwnam("apache") ) +{ + die "Error creating apache user or group" unless ( + system(qw(/usr/sbin/useradd -u 102 -g 102 -o -c 'Apache' -d /var/www -M -s /bin/nologin apache)) == 0); +} + +#set apache gid if different of 102 +my $apachegidtest = getgrnam("apache"); +if ( $apachegidtest != '102' ) +{ + die "Error changing apache gid" unless ( + system(qw(/usr/sbin/groupmod -g 102 -o apache)) == 0); +} + +#set apache uid if different of 102 +my $apacheuidtest = getpwnam("apache"); +if ( $apacheuidtest != '102' ) +{ + die "Error changing apache uid " unless ( + 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 (