Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 06/12/2018, à 11:27

general alcazar

[Résolu] logrotate problèmes de droits

Bonjour,

Après l'installation d'apache sur mon raspberry, le service refusait de se lancer après chaque redémarrage pour cause d'absence de /var/log/apache2.
Ceci était provoqué par le fait que le point de montage de /var/log, situé dans la ram pour diminuer le nombre d'écritures sur la carde SD du raspberry, disparaissait à chaque redémarrage.
J'avais résolu le problème avec ce script (trouvé sur le oueb) qui s'exécute à chaque démarrage :

#!/bin/bash
#
### BEGIN INIT INFO
# Provides:          apache2-tmpfs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Required-Start:  
# Required-Stop:   
# Short-Description: Create /var/log/apache2/error.log on tmpfs at startup
# Description:       Create /var/log/apache2/error.log needed by Apache.
### END INIT INFO

#
# main()
#
case "${1:-''}" in
  'start')
   # create the /var/log/apache2/error.log needed by apache
   mkdir /var/log/apache2
   chmod 777 /var/log/apache2
   touch /var/log/apache2/error.log
   chmod 777 /var/log/apache2/error.log
   ;;
  'stop')
   ;;
  'restart')
   ;;
  'reload'|'force-reload')
   ;;
  'status')
   ;;
  *)
   echo "Usage: $SELF start"
   exit 1
   ;;
esac

Maintenant le problème est que logrotate se plaint avec le message suivant :

/etc/cron.daily/logrotate:
error: skipping "/var/log/apache2/access.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
error: skipping "/var/log/apache2/error.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
error: skipping "/var/log/apache2/other_vhosts_access.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
run-parts: /etc/cron.daily/logrotate exited with return code 1

voici le résultat d'un ls -l de /var/log/

pi@raspberrypi2:~ $ ls -l /var/log
total 2480
drwxrwxrwx 2 root root    100 déc.   3 06:48 apache2
-rw-r----- 1 root adm   57302 déc.   6 10:23 auth.log
-rw-r--r-- 1 root root   5817 déc.   3 06:48 boot.log
-rw------- 1 root utmp      0 déc.   3 06:48 btmp
-rw-r----- 1 root adm  807035 déc.   6 10:23 daemon.log
-rw-r----- 1 root adm    1346 déc.   3 06:48 debug
-rw-r----- 1 root adm  618713 déc.   6 10:23 kern.log
-rw-r----- 1 root adm    2557 déc.   6 06:25 mail.info
-rw-r----- 1 root adm    2557 déc.   6 06:25 mail.log
-rw-r----- 1 root adm  404475 déc.   6 10:22 messages
-rw------- 1 root root    185 déc.   3 06:48 php7.0-fpm.log
-rw-r--r-- 1 pi   root      0 déc.   3 06:48 syncthing
-rw-r----- 1 root adm   78352 déc.   6 10:23 syslog
-rw-r----- 1 root adm  415903 déc.   6 06:25 syslog.1
-rw-r----- 1 root adm   42115 déc.   5 06:25 syslog.2.gz
-rw-r----- 1 root adm   60017 déc.   4 06:25 syslog.3.gz
-rw-r----- 1 root adm    1842 déc.   3 06:48 user.log
-rw-rw-r-- 1 root utmp   6912 déc.   6 08:13 wtm

et celui de /var/log/apache2

pi@raspberrypi2:~ $ ls -l /var/log/apache2/
total 1520
-rw-r--r-- 1 root root 1546726 déc.   6 09:13 access.log
-rwxrwxrwx 1 root root    4529 déc.   6 07:14 error.log
-rw-r--r-- 1 root root       0 déc.   3 06:48 other_vhosts_access.log

Comment résoudre ce problème ? Et merci de m'avoir lu smile

edit:
La solution consiste à remplacer dans le script de création du dossier "/var/log/apache2" les 2

chmod 777 

par

chmod 640

Dernière modification par general alcazar (Le 15/12/2018, à 07:07)

Hors ligne