Table des matières
- 2026:
- 2025:
1 billet(s) pour avril 2026
| Notes ping ICMP | 2026/04/03 23:01 | Jean-Baptiste |
Changer le nom ou l'IP d'un serveur GNU/Linux
Template VM
Voir :
RedHat registration
subscription-manager unregister
subscription-manager remove --all
subscription-manager clean
Hostname
hostnamectl set-hostname localhost.localdomain
Udev
rm -rf /etc/udev/rules.d/70-*
machine-id
chmod 777 /etc/machine-id > /etc/machine-id chmod 444 /etc/machine-id
Voir aussi :
- /sys/class/dmi/id/product_uuid
- /sys/class/dmi/id/product_name
Qui peuvent être copiés sur l'image cible pour savoir sur quel matériel l'image a été créée.
Réseau
rm -f /etc/sysconfig/network-scripts/ifcfg-eth* #sed -i '/UUID/c\UUID=' /etc/sysconfig/network-scripts/ifcfg-eth0 #sed -i '/HWADDR/c\HWADDR=' /etc/sysconfig/network-scripts/ifcfg-eth0
Clean /var/log/
find /var/log/ -type f -name "*[-_]2018[0-9][1-9][0-9][1-9]*" -delete find /var/log/ -type f -name "*.old" -delete rm -rf /var/log/journal/* systemd-tmpfiles --create --prefix /var/log/journal systemctl restart systemd-journald #for fic in $(find /var/log/ -type f) ; do > $fic ; done find /var/log/ -type f -exec /bin/sh -c '>{}' \; rm /var/log/sysstat/* -rf find /var/log/ -type f -name "*.*[0-9]" -delete find /var/log/ -type f -name "*.gz" -delete
# Debian killall dhclient #rm /var/lib/dhcp/dhclient.eth0.leases rm -f /var/lib/dhcp/* killall ntpd rm /run/ntp.conf.dhcp
Autres RedHat
# systemctl enable initial-setup.service # sys-unconfig # touch /.unconfigured
Bash history
rm -f /root/.bash_history rm -f /home/*/.bash_history history -c && history -w
Poweroff
poweroff
Renommer un serveur
grep $(hostname -s) -Ril /etc/
Fichier à modifier
- /etc/machine-id
- /etc/hosts
- /etc/hostname
- /etc/mailname
- /etc/exim4/update-exim4.conf.conf
- /etc/machine-info
- /etc/sysconfig/network
rm -f /etc/machine-id systemd-machine-id-setup
SSH
dpkg-reconfigure openssh-server
Ou
# CHANGER LE HOSTNAME AVANT ! #rm /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub #rm /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub #rm /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub #ssh-keygen -h -N '' -t rsa -f /etc/ssh/ssh_host_rsa_key #ssh-keygen -h -N '' -t dsa -f /etc/ssh/ssh_host_dsa_key #ssh-keygen -h -N '' -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key rm -f /etc/ssh/ssh_host_* /usr/bin/ssh-keygen -A
hostnamectl set-hostname nouveau-nom systemctl restart systemd-hostnamed
Changement d'adresse IP
Fichier à modifier
- /etc/resolv.conf
- /etc/systemd/resolved.conf
- /etc/network/interfaces
Conf client DNS
- /etc/resolv.conf
#domain acme.local search acme.local options rotate timeout:1 retries:1 #options edns0 nameserver 192.168.10.253 nameserver 192.168.11.253
Avec SystemD voir /etc/systemd/resolved.conf
Généralités
Parfois il faut aussi modifier les fichiers suivants
- /etc/motd
- /etc/issue
Notes génériques RedHat Centos Rocky AlmaLinux
Alternatives à RedHat / CentOS :
- AlmaLinux
- Rocky Linux
CERN supports both RHEL and AlmaLinux, and in addition CentOS 7 ELS
Notes GED qrcode
Lien :
zbar à l'air moins capricieux que zxing
java -cp /opt/srv/plugins/GedPlugin/lib/zxing/javase.jar:/opt/srv/plugins/GedPlugin/lib/zxing/core.jar com.google.zxing.client.j2se.CommandLineRunner /tmp/ged/SKM_C224e16042810430_NOK-00.jpg --try_harder --multi
Erreur
file:/tmp/ged/SKM_C224e16042810430_NOK-00.jpg: No barcode found
Avec Zbar
zbarimg SKM_C224e16042810430_NOK-00.jpg
QR-Code:ged;002071 QR-Code:ged;002071 scanned 2 barcode symbols from 1 images in 0.6 seconds
Notes install sur CentOS7
Lien :
Install des dépendances
yum install ImageMagick-c++ libXv libv4l
Install
wget wget https://copr-be.cloud.fedoraproject.org/results/mmraka/epel7-addons/epel-7-x86_64/zbar-0.10-15.fc19/zbar-0.10-15.el7.centos.x86_64.rpm rpm -Uvh zbar-0.10-15.el7.centos.x86_64.rpm
Notes gdb debug
Voir :
Voir aussi
$ python3 -c "import pymssql ; conn = pymssql.connect(server='127.0.0.1', port='1433', user=r'ACME\user1', password=r'P@ssw0rd!', database='dbname')" Segmentation fault (core dumped)
$ gdb --args python3 -c "import pymssql ; conn = pymssql.connect(server='127.0.0.1', port='1433', user=r'ACME\user1', password=r'P@ssw0rd!', database='dbname')" (gdb) r (gdb) bt
Automount montage automatique clef USB
Brouillon
Source :
Voir :
Voir aussi :
- udevil
- udisks2
- Autofs
- udisks-glue
- usbmount
Contexte
Pas d’environnement graphique.
Manip
Voir aussi udisks2
Hack avec la commande at. Voir notes_systemd_udev
apt-get install pmount
/etc/udev/rules.d/90-automount.rules
ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/usr/local/bin/h_pmount.sh %k" ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/usr/local/bin/h_pumount.sh /dev/%k"
/usr/local/bin/h_pmount.sh
#! /bin/bash echo "/usr/bin/pmount -r $*" |at now
/usr/local/bin/h_pumount.sh
#! /bin/bash echo "/usr/bin/pumount $*" |at now
# udevadm control --reload udevadm control --reload-rules udevadm trigger
Notes
udevadm control --log-priority=err unbuffer udevadm monitor --environment
blkid -o value -s UUID /dev/sda1
usbmount
Source : https://github.com/rbrito/usbmount
Debug
Troubleshooting USBmount :
- Do you have HAL running ? Any GNOME or KDE daemon automounting devices ?
- Let's suppose that the partition containing the filesystem that you want USBmount to automatically handle is /dev/sda1 (your case may, quite possibly, vary). Then, check the result of the following command :
udevadm test --action=add /sys/class/block/sda1
The command above just gives diagnostics of what USBmount would do with the device, but it doesn't actually mount or interfere with the device. It is intended for debugging purposes. Be careful that it generates a lot of output. Many screens, depending on the device.
- Under the same assumptions as the above, another good diagnostic tool is the following :
udevadm info -a -p $(udevadm info -q path -n /dev/sdb1)
Autres
Remounting filesystems without physical removal
udevadm trigger --action=add /dev/sdd2
Plop
/etc/udev/rules.d/automount.rules
# automounting usb flash drives # umask is used to allow every user to write on the stick # we use --sync in order to enable physical removing of mounted memory sticks -- this is OK for fat-based sticks # I don't automount sda since in my system this is the internal hard drive # depending on your hardware config, usb sticks might be other devices than sdb* #SUBSYSTEMS=="usb",ACTION=="add",KERNEL=="sd[b-z][1-9]", RUN+="/usr/bin/pmount --sync --umask 000 %k" SUBSYSTEMS=="usb",ACTION=="add",KERNEL=="sd[b-z][1-9]", RUN+="/usr/bin/pmount --read-only --charset utf8 %k" SUBSYSTEMS=="usb",ACTION=="remove", KERNEL=="sd[b-z][1-9]", RUN+="/usr/bin/pumount %k"
/etc/udev/rules.d/automount.rules
ACTION=="add",KERNEL=="sd[a-z][0-9]",RUN+="/usr/bin/pmount -r 000 %k" ACTION=="remove",KERNEL=="sd[a-z][0-9]",RUN+="/usr/bin/pumount /dev/%k" ACTION=="add", KERNEL=="sd[b-z]*", PROGRAM="/bin/sh -c '/bin/sleep 2; /sbin/blkid -c /dev/null -s UUID -o value /dev/%k", RUN+="/bin/sh -c '/bin/sleep 3 ; /usr/bin/pmount -r --charset utf8 %c'" ACTION=="remove", KERNEL=="sd[b-z]*", RUN+="/usr/bin/pumount %k"
