Quels sont les droits sur l'arborescence /var?

Salut, j’ai fait un « petit » chown root:root -R /var un peu violent sur le répertoire /var :sweat_smile: :face_with_head_bandage:
Et je souhaite remettre les bons droits car rien ne démarre plus après le reboot.
J’arrive à relancer manuellement Apache mais pas Maria db et tout vient de là j’en suis convaincu!
Le message dans le syslog est clair:

*Feb 21 16:49:26 raspjeedom mysqld[26157]: 2023-02-21 16:49:26 0 [Warning] Can't create test file /var/lib/mysql/raspjeedom.lower-test*
*Feb 21 16:49:26 raspjeedom mysqld[26157]: /usr/sbin/mysqld: Can't create file '/var/log/mysql/error.log' (errno: 13 "Permission denied")*
*Feb 21 16:49:26 raspjeedom mysqld[26157]: 2023-02-21 16:49:26 0 [Note] Starting MariaDB 10.3.38-MariaDB-0+deb10u1 source revision c73985f2ce8a391582787f3e310a011c1a712bec as process 26157*
*Feb 21 16:49:26 raspjeedom mysqld[26157]: 2023-02-21 16:49:26 0 [ERROR] mysqld: File '/var/lib/mysql/aria_log_control' not found (Errcode: 13 "Permission denied")*
*Feb 21 16:49:26 raspjeedom mysqld[26157]: 2023-02-21 16:49:26 0 [ERROR] mysqld: Got error 'Can't open file' when trying to use aria control file '/var/lib/mysql/aria_log_control'*
*Feb 21 16:49:26 raspjeedom mysqld[26157]: 2023-02-21 16:49:26 0 [ERROR] Plugin 'Aria' init function returned error.*
*Feb 21 16:49:26 raspjeedom mysqld[26157]: 2023-02-21 16:49:26 0 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.*
*Feb 21 16:49:26 raspjeedom mysqld[26157]: 2023-02-21 16:49:26 0 [Warning] The parameter innodb_large_prefix is deprecated and has no effect. It may be removed in future releases. See https://mariadb.com/kb/en/library/xtradbinnodb-file-format/*
*Feb 21 16:49:26 raspjeedom mysqld[26157]: 2023-02-21 16:49:26 0 [Note] InnoDB: Using Linux native AIO*
*Feb 21 16:49:26 raspjeedom mysqld[26157]: 2023-02-21 16:49:26 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable*
*Feb 21 16:49:26 raspjeedom mysqld[26157]: 2023-02-21 16:49:26 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable*

J’ai déjà remis à place dans /var/www/html (via la commande sudo chown www-data:www-data -R /var/www/html/* )
Masi ça n’est pas suffisant.
Qq’un pourrait me donner l’arborescence des droits svp??

Merci.

PS: je suis en dernière version debian et Jeedom,

Tu es mon héro ! Fallait oser !

(désolé, c’est pas constructif, mais je devais l’écrire. Si personne ne répond, je t’envoie ce que je peux ce soir)

tout ça parce que le certificat Let’s Encrypt ne s’installait pas bien !! :cold_face:

1 « J'aime »

Bonjour,

Tu a testé l’option dans Réglages / Système / Configuration / OS-DB : Rétablissement des droits des dossiers et fichiers pour commencer ?

Sinon oui un « petit » chown mysql:mysql -R /var/lib/mysql devrait permettre à mysql de redémarrer…

Chez moi :

root@Jeedom-dev:~# ls -ld /var/* | grep "^d"
drwxr-xr-x  2 root     root     4096 17 févr. 06:25 /var/backups
drwxr-xr-x 14 root     root     4096 19 sept. 22:24 /var/cache
drwxr-xr-x 41 root     root     4096  1 janv. 17:15 /var/lib
drwxrwsr-x  2 root     staff    4096  3 sept. 14:10 /var/local
drwxr-xr-x 13 root     root     4096 19 févr. 00:00 /var/log
drwxrwsr-x  2 root     mail     4096 20 févr. 00:50 /var/mail
drwxr-xr-x  2 root     root     4096 17 sept. 17:56 /var/opt
drwxr-xr-x  6 root     root     4096 17 févr. 04:35 /var/spool
drwxrwxrwt  4 root     root     4096 21 févr. 23:39 /var/tmp
drwxrwxr-x  3 www-data www-data 4096 19 sept. 22:24 /var/www

et

root@Jeedom-dev:~# ls -ld /var/*/* | grep "^d"
drwxr-xr-x   3 root        root                4096 19 sept. 22:24 /var/cache/apache2
drwxr-xr-x   3 root        root                4096 17 sept. 18:27 /var/cache/apparmor
drwxr-xr-x   3 root        root                4096 20 févr. 00:50 /var/cache/apt
drwxr-xr-x   2 root        root                4096 17 févr. 04:30 /var/cache/debconf
drwxr-xr-x   2 root        root                4096 17 sept. 18:23 /var/cache/dictionaries-common
drwxr-xr-x   2 root        root                4096 30 oct.  10:02 /var/cache/fontconfig
drwx------   2 root        root                4096 17 févr. 04:36 /var/cache/ldconfig
drwxr-xr-x   2 root        root                4096 21 févr. 06:25 /var/cache/locate
drwxr-xr-x  39 man         man                 4096 21 févr. 00:00 /var/cache/man
drwxr-xr-x   3 root        root                4096 19 sept. 22:04 /var/cache/PackageKit
drwx------   2 root        root                4096 17 sept. 18:27 /var/cache/private
drwxr-xr-x   3 root        root                4096 21 févr. 23:35 /var/cache/samba
drwxr-xr-x   5 root        root                4096 19 sept. 22:25 /var/lib/apache2
drwxr-xr-x   5 root        root                4096 17 févr. 04:35 /var/lib/apt
drwxr-xr-x   2 root        root                4096 17 févr. 04:31 /var/lib/aptitude
drwxr-xr-x   2 root        root                4096 17 sept. 18:23 /var/lib/aspell
drwxr-xr-x   2 root        root                4096 17 sept. 18:21 /var/lib/dbus
drwxr-xr-x   2 root        root                4096 17 sept. 18:27 /var/lib/dhcp
drwxr-xr-x   5 root        root                4096 17 sept. 18:21 /var/lib/dictionaries-common
drwxr-xr-x   7 root        root                4096 20 févr. 00:49 /var/lib/dpkg
drwxr-xr-x   3 root        root                4096 17 sept. 18:21 /var/lib/emacsen-common
drwxr-xr-x   2 root        root                4096 17 févr. 08:00 /var/lib/exim4
drwxr-xr-x   2 root        root                4096 19 sept. 22:08 /var/lib/fail2ban
drwxr-xr-x   2 geoclue     geoclue             4096 17 mars   2021 /var/lib/geoclue
drwxr-xr-x   4 root        root                4096 30 oct.  10:02 /var/lib/ghostscript
drwxr-xr-x   2 root        root                4096 10 mars   2021 /var/lib/git
drwxr-xr-x   3 root        root                4096 17 sept. 18:24 /var/lib/grub
drwxr-xr-x   2 root        root                4096 17 sept. 18:21 /var/lib/ispell
drwxr-xr-x   2 knxd        knxd                4096 19 sept. 23:05 /var/lib/knxd
drwxr-xr-x   2 root        root                4096 21 févr. 00:00 /var/lib/logrotate
drwxr-xr-x   2 root        root                4096 17 sept. 18:22 /var/lib/man-db
drwxr-xr-x   2 root        root                4096  3 sept. 14:10 /var/lib/misc
drwxr-xr-x   5 mysql       mysql               4096 17 févr. 06:15 /var/lib/mysql
drwxr-xr-x   2 ntp         ntp                 4096 21 févr. 21:15 /var/lib/ntp
drwxr-xr-x   2 root        root                4096 28 juin   2021 /var/lib/os-prober
drwxr-xr-x   2 root        root                4096 19 sept. 22:06 /var/lib/PackageKit
drwxr-xr-x   2 root        root                4096 17 sept. 18:22 /var/lib/pam
drwxr-xr-x   4 root        root                4096 19 sept. 22:25 /var/lib/php
drwx------   3 root        root                4096 17 sept. 17:59 /var/lib/polkit-1
drwx------   2 root        root                4096 17 sept. 18:27 /var/lib/private
drwxr-xr-x   2 root        root                4096 17 sept. 18:19 /var/lib/python
drwxr-xr-x   2 root        root                4096 17 sept. 18:40 /var/lib/resolvconf
drwxr-xr-x   5 root        root                4096 17 févr. 04:36 /var/lib/samba
drwxr-xr-x   2 root        root                4096 19 sept. 22:06 /var/lib/sntp
drwxr-xr-x   3 root        root                4096 19 sept. 22:06 /var/lib/sudo
drwxr-xr-x  11 root        root                4096 19 sept. 22:06 /var/lib/systemd
drwxr-xr-x   3 root        root                4096 30 oct.  10:02 /var/lib/ucf
drwxr-xr-x   2 root        root                4096 19 févr.  2021 /var/lib/unattended-upgrades
drwxr-xr-x   3 root        root                4096 17 sept. 18:00 /var/lib/vim
drwxr-xr-x   2 root        root                4096 19 sept. 22:16 /var/lib/xfonts
drwxr-xr-x   2 root        root                4096 17 févr. 04:31 /var/lib/xkb
drwxr-xr-x   2 www-data    root                  40 17 févr. 06:15 /var/lock/apache2
drwxr-xr-x   2 root        root                  40 17 févr. 06:15 /var/lock/subsys
drwxr-x---   2 root        adm                 4096 21 févr. 00:00 /var/log/apache2
drwxr-xr-x   2 root        root                4096 17 févr. 04:35 /var/log/apt
drwxr-s---   2 Debian-exim adm                 4096 21 févr. 00:30 /var/log/exim4
drwxr-xr-x   3 root        root                4096 17 sept. 18:27 /var/log/installer
drwxr-sr-x+  3 root        systemd-journal     4096 17 sept. 18:27 /var/log/journal
drwxr-s---   2 mysql       adm                 4096 19 sept. 22:24 /var/log/mysql
drwxr-xr-x   2 ntp         ntp                 4096 23 sept.  2020 /var/log/ntpstats
drwx------   2 root        root                4096 17 sept. 18:27 /var/log/private
drwxr-xr-x   3 root        root                4096 17 sept. 18:21 /var/log/runit
drwxr-x---   3 root        adm                 4096 19 févr. 00:00 /var/log/samba
drwxr-x---   2 root        adm                 4096 18 févr. 00:00 /var/log/unattended-upgrades
drwxr-xr-x   2 root        root                  60 21 févr. 00:00 /var/run/apache2
drwxr-xr-x   2 avahi       avahi                 80 17 févr. 06:15 /var/run/avahi-daemon
drwxr-xr-x   2 root        root                  80 17 févr. 06:15 /var/run/console-setup
drwxr-xr-x   2 root        root                  40 17 févr. 06:15 /var/run/credentials
drwxr-xr-x   2 root        root                  60 17 févr. 06:15 /var/run/dbus
drwxr-x---   2 Debian-exim Debian-exim           60 17 févr. 08:00 /var/run/exim4
drwxr-xr-x   2 root        root                  80 17 févr. 06:28 /var/run/fail2ban
drwx------   2 root        root                  80 17 févr. 06:15 /var/run/initramfs
drwxrwxrwt   4 root        root                  80 17 févr. 06:15 /var/run/lock
drwxr-xr-x   3 root        root                  60 17 févr. 06:15 /var/run/log
drwxr-xr-x   2 root        root                  40 17 févr. 06:15 /var/run/mount
drwxr-xr-x   2 mysql       root                  80 17 févr. 06:15 /var/run/mysqld
drwxr-xr-x   2 root        root                 120 17 févr. 06:15 /var/run/network
drwxr-xr-x   3 root        root                 140 17 févr. 06:15 /var/run/resolvconf
drwxr-xr-x   5 root        root                 400 19 févr. 00:00 /var/run/samba
drwxr-xr-x   2 root        root                  40 17 févr. 06:15 /var/run/sendsigs.omit.d
drwxr-xr-x   2 root        root                  40 17 févr. 06:15 /var/run/sshd
drwx--x--x   3 root        root                  60 17 févr. 06:15 /var/run/sudo
drwxr-xr-x  20 root        root                 480 17 févr. 06:28 /var/run/systemd
drwxr-xr-x   2 root        root                  60 17 févr. 06:15 /var/run/tmpfiles.d
drwxr-xr-x   7 root        root                 180 17 févr. 06:15 /var/run/udev
drwxr-xr-x   3 root        root                  60 21 févr. 21:47 /var/run/user
drwxr-xr-x   5 root        root                4096 19 sept. 22:17 /var/spool/cron
drwxr-x---   5 Debian-exim Debian-exim         4096 19 sept. 22:18 /var/spool/exim4
drwx------   2 root        root                4096 20 mai    2022 /var/spool/rsyslog
drwxrwxrwt   2 root        root                4096  9 août   2022 /var/spool/samba
drwx------   3 root        root                4096 17 févr. 06:15 /var/tmp/systemd-private-9491529eed0847abad80a683de223b3c-ntp.service-H4VXIg
drwx------   3 root        root                4096 17 févr. 06:15 /var/tmp/systemd-private-9491529eed0847abad80a683de223b3c-systemd-logind.service-dSYgui

En espérant avoir aidé un peu…

Merci de votre aide, tout est reparti grâce à vos lsitings !! :wave: J’ai remis les droits impecc.

sudo chown root:mail -R /var/mail
sudo chown www-data:www-data -R /var/www
sudo chown geoclue:geoclue -R /var/lib/geoclue
sudo chown ntp:ntp -R /var/lib/ntp
sudo chown www-data:root -R /var/lock/apache2
sudo chown root:adm -R /var/log/apache2
sudo chown mysql:adm -R /var/log/mysql
sudo chown ntp:ntp -R /var/log/ntpstats
sudo chown root:adm -R /var/log/samba
sudo chown root:adm -R /var/log/unattended-upgrades

J’ai juste dû supprimer le fichier /var/lib/mysql/tc.log qui était bloqué (sans doute lors du plantage)

Pour info, comme Mysql ne redémarrait pas je suis aller voir dans les logs

pi@raspjeedom:~ $ tail -f /var/log/mysql/error.log
2023-02-22 8:06:16 0 [Note] InnoDB: File ‹ ./ibtmp1 › size is now 12 MB.
2023-02-22 8:06:16 0 [Note] InnoDB: 10.3.38 started; log sequence number 15064950048; transaction id 22611912
2023-02-22 8:06:16 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2023-02-22 8:06:16 0 [Note] Plugin ‹ FEEDBACK › is disabled.
2023-02-22 8:06:16 0 [Note] Recovering after a crash using tc.log
2023-02-22 8:06:16 0 [ERROR] Bad magic header in tc log
2023-02-22 8:06:16 0 [ERROR] Crash recovery failed. Either correct the problem (if it’s, for example, out of memory error) and restart, or delete tc log and start mysqld with --tc-heuristic-recover={commit|rollback}
2023-02-22 8:06:16 0 [ERROR] Can’t init tc log
2023-02-22 8:06:16 0 [ERROR] Aborting

puis un petit

sudo mv /var/lib/mysql/tc.log /var/lib/mysql/tc_bakup.log

et tout est bien reparti au reboot suivant :sweat_smile:

Je ferais plus gaffe en prenant les manip sur Internet, et surtout la leçon : « vérifier et sauvegarder ce qu’il y a avant, pour pouvoir les remettre après cas de pb !!! »

Et il faut savoir que en tant que root, tout t’est permis, même ce qui est interdit ou qui peut planter ton système. Je te conseille d’y réfléchir à deux fois avant de lancer une commande qui est conseillée par je-ne-sais-qui sur je-ne-sais-quel forum.

Je te recommande la prudence et de te documenter en réfléchissant aux différentes conséquences.

Mais n’empèche, j’ai bien ri en lisant ton post !

1 « J'aime »

Comme on dit, il y a 2 sortes d’administrateur système, celui qui a déjà fait une connerie en étant root et celui qui va la faire :wink:

1 « J'aime »

Hello, je trouve que c’est une mauvaise idée de réparer ce genre de bétise, une réinstall propre (+restauration) semble la meilleure solution pour éviter tout problème futur d’un dossier oublié ou avec les mauvais droits ! ça prend 1h et ça t’évitera bcp de problème à venir.

Ce sujet a été automatiquement fermé après 24 heures suivant le dernier commentaire. Aucune réponse n’est permise dorénavant.