Outils pour utilisateurs

Outils du site


blog

DHCP DNS - Désactiver la mise à jour du fichier /etc/resolv.conf

Conf dhclient.conf

Nettoyer la conf de l'ancien DHCP

killall dhclient
rm /var/lib/dhcp/*.leases
> /etc/resolv.conf

Forcer un ou plusieurs serveurs DNS /etc/dhcp/dhclient.conf

supersede domain-name "example.com";
supersede domain-search "example.com";
supersede domain-name-servers 127.0.0.1;
#supersede domain-name-servers 8.8.8.8, 8.8.4.4;

RedHat

/etc/sysconfig/network-scripts/ifcfg-enp0s3

PEERDNS=no

Debian

Voir : https://wiki.debian.org/resolv.conf

echo 'make_resolv_conf() { :; }' > /etc/dhcp/dhclient-enter-hooks.d/leave_my_resolv_conf_alone
chmod 755 /etc/dhcp/dhclient-enter-hooks.d/leave_my_resolv_conf_alone
Autres

/etc/network/interfaces

 iface eth0 inet static
    address 192.168.1.3
    netmask 255.255.255.0
    gateway 192.168.1.1
    dns-nameserver 192.168.1.254
    dns-nameserver 8.8.8.8
    dns-search foo.org bar.com

NetworkManager

Obsolète /etc/NetworkManager/NetworkManager.conf

[main]
#dns=dnsmasq
dns=none

Solution

nmcli connection edit Livebox-2277
nmcli> goto ipv4
nmcli ipv4> set ignore-auto-dns
Saisissez la valeur « ignore-auto-dns » : true
nmcli ipv4> save permanent
Connexion « Livebox-2277 » (50247bd3-25f1-41a7-b96c-2bd40462423a) mise à jour.
nmcli connection up Livebox-2277

Faire pareille pour ipv6

ou

nmcli connection modify Livebox-2277 ipv4.ignore-auto-dns true
nmcli connection modify Livebox-2277 ipv6.ignore-auto-dns true

Autres

root@raspberrypi:/home/pi# cat /etc/resolv.conf
# Generated by resolvconf
domain home
nameserver 192.168.1.1
root@raspberrypi:/home/pi# which resolvconf 
/sbin/resolvconf
root@raspberrypi:/home/pi# dpkg -S /sbin/resolvconf
openresolv: /sbin/resolvconf
2025/03/24 15:06

/dev/one

Générer 11111111 soit 0xFF

tr '\000' '\377' < /dev/zero
dd if=<(tr '\000' '\377' < /dev/zero) count=1 bs=512 of=data_ones.bin
2025/03/24 15:06

Désactiver le son au démarrage d un mac

Source : http://korben.info/comment-desactiver-le-son-au-demarrage-dun-mac.html

Ne semble pas marcher sous Yosemite. Il est aussi possible de couper le son avant d’éteindre l'ordinateur

sudo nvram SystemAudioVolume=%80

Pour réactiver

sudo nvram -d SystemAudioVolume
2025/03/24 15:06

Désactiver le reboot via ctrl-alt-del - Disable reboot using ctrl-alt-del keys

Disable reboot using Ctrl-Alt-Del Keys in RHEL / CentOS

Source : https://www.linuxtechi.com/disable-reboot-using-ctrl-alt-del-keys/

In Linux , It’s a security concern for us to allow anyone to reboot the server using Ctrl-Alt-Del keys. It is always recommended in production boxes that one should disable reboot using Ctrl-Alt-Del keys.

In this article we will discuss how can we disable reboot via above keys in RHEL & CentOS

For RHEL 5.X & CentOS 5.X

To prevent the init process from handling Ctrl-Alt-Del, edit the file /etc/inittab :

/etc/inittab

# Trap CTRL-ALT-DELETE
#ca::ctrlaltdel:/sbin/shutdown -t3 -r now

We can also modify the line to generate logs, if anybody try to reboot the server using the keys ,

/etc/inittab

# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/bin/logger -p authpriv.warning -t init "Console-invoked Ctrl-Alt-Del was ignored"
For RHEL6.X & CentOS 6.X

In RHEL 6.X / CentOS 6.X , reboot using the keys are handled by the file /etc/init/control-alt-delete.conf.

Step:1 Before making the changes, first take the backup using below command

cp -p /etc/init/control-alt-delete.conf{,.orig}

Step:2 Edit the file, replacing the exec /sbin/shutdown line with the following, which will simply generate a log entry each time Ctrl-Alt-Del is pressed:

/etc/init/control-alt-delete.conf

exec /usr/bin/logger -p authpriv.notice -t init "Ctrl-Alt-Del was pressed and ignored"
For RHEL 7.x & CentOS 7.x

Run either of the beneath command from the console to disable reboot using ‘CTRL+ALT+DELETE’ keys in RHEL 7.x and CentOS 7.x

ln -sf /dev/null /etc/systemd/system/ctrl-alt-del.target

OR

systemctl mask ctrl-alt-del.target

reboot.target https://www.2daygeek.com/how-to-avoid-or-prevent-accidental-shutdown-or-reboot-on-linux/

# systemctl mask reboot.target
Created symlink /etc/systemd/system/reboot.target → /dev/null.

# systemctl mask poweroff.target
Created symlink /etc/systemd/system/poweroff.target → /dev/null.

# systemctl mask halt.target
Created symlink /etc/systemd/system/halt.target → /dev/null.
2025/03/24 15:06

Désactiver l'arret du système en appuyant sur le bouton marche/arrêt

disable shutdown by press the power button - Prevent PC from shutting down on Power button

SystemD

/etc/systemd/logind.conf

[Login]
#HandlePowerKey=poweroff
#HandlePowerKey=idle
HandlePowerKey=lock
 
#PowerKeyIgnoreInhibited=no
PowerKeyIgnoreInhibited=yes
 
#HandleLidSwitch=suspend
HandleLidSwitch=ignore
systemctl restart systemd-logind.service
systemctl show systemd-logind.service

ACPI

/etc/acpi/powerbtn-acpi-support.sh

FIXME

2025/03/24 15:06
blog.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki