Linuxhotel Wiki

Wie ging das nochmal?

Benutzer-Werkzeuge

Webseiten-Werkzeuge


lpi1:bootloader

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen gezeigt.

Link zu der Vergleichsansicht

Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung
Nächste Überarbeitung
Vorherige Überarbeitung
Nächste Überarbeitung Beide Seiten, nächste Überarbeitung
lpi1:bootloader [2015/11/17 08:40]
ingo_wichmann [Grub installieren]
lpi1:bootloader [2019/11/06 20:36]
ingo_wichmann [Grub2 mit Passwort absichern]
Zeile 1: Zeile 1:
 ====== Bootloader ====== ====== Bootloader ======
 ===== Bootloader löschen ===== ===== Bootloader löschen =====
-  dd if=/​dev/​zero of=/dev/sda bs=446 count=1+  dd if=/​dev/​zero of=/dev/sda bs=$((512-64)) ​count=1
  
 ===== grub2 ===== ===== grub2 =====
Zeile 35: Zeile 35:
   grub-mkconfig --output=/​boot/​grub/​grub.cfg   grub-mkconfig --output=/​boot/​grub/​grub.cfg
  
 +=== centos (ab 7) ===
 +siehe [[#grubby]]
 ==== Grub2 mit Passwort absichern ==== ==== Grub2 mit Passwort absichern ====
 === Root Passwort ändern === === Root Passwort ändern ===
-Grub Bootprompt: ''​init=/​bin/​bash''​ hinzufügen+Grub Bootprompt: ''​init=/​bin/​bash'' ​als Parameter zum Linux Kernel ​hinzufügen
  
 Kernel mit ''​strg+x''​ booten Kernel mit ''​strg+x''​ booten
Zeile 43: Zeile 45:
   mount -o remount,rw /   mount -o remount,rw /
   passwd   passwd
 +
 +  touch /​.autorelabel
 +
 +((nur bei Systemen mit aktiviertem SELinux notwendig))
 +
   mount -o remount,ro /   mount -o remount,ro /
   exec /sbin/init   exec /sbin/init
  
 === Grub absichern === === Grub absichern ===
-Debian 6.0, CentOS 7:+== Passwort Hash erzeugen == 
 +Debian 6, CentOS 7:
   grub2-mkpasswd-pbkdf2   grub2-mkpasswd-pbkdf2
  
-Debian 7, Ubuntu (ab 14.04):+Debian ​(ab 7), Ubuntu (ab 14.04):
   grub-mkpasswd-pbkdf2   grub-mkpasswd-pbkdf2
  
-''​/​etc/​grub.d/​45_password''​ : +== Passwort Hash eintragen == 
-<file>+<file txt /​etc/​grub.d/​45_password>​
 #!/bin/sh #!/bin/sh
 exec tail -n +3 $0 exec tail -n +3 $0
Zeile 66: Zeile 74:
   chmod +x /​etc/​grub.d/​45_password   chmod +x /​etc/​grub.d/​45_password
  
 +== grub Konfigurationsdatei neu erzeugen ==
 Debian (ab 6), Ubuntu (14.04): Debian (ab 6), Ubuntu (14.04):
   grub-mkconfig -o /​boot/​grub/​grub.cfg   grub-mkconfig -o /​boot/​grub/​grub.cfg
Zeile 71: Zeile 80:
 CentOS (7): CentOS (7):
   grub2-mkconfig -o /​boot/​grub2/​grub.cfg   grub2-mkconfig -o /​boot/​grub2/​grub.cfg
 +oder
 +  grub2-mkconfig -o "​$(readlink -e /​etc/​grub2.conf)"​
 +oder für UEFI-Systeme:​
 +  grub2-mkconfig -o "​$(readlink -e /​etc/​grub2-efi.cfg)"​
 +
 +== Auswahl ermöglichen,​ editieren absichern ==
 +<file txt /​etc/​grub.d/​10_linux>​
 +...
 +CLASS="​--class gnu-linux --class gnu --class os --unrestricted"​
 +...
 +</​file>​
  
 == testen == == testen ==
 +Debian (ab 6), Ubuntu (14.04):
   grep password /​boot/​grub/​grub.cfg   grep password /​boot/​grub/​grub.cfg
 +  reboot
 +CentOS (7):
 +  grep password /​boot/​grub2/​grub.cfg
   reboot   reboot
  
 === Doku === === Doku ===
   * https://​www.gnu.org/​software/​grub/​manual/​html_node/​Security.html   * https://​www.gnu.org/​software/​grub/​manual/​html_node/​Security.html
 +
 +===== grubby =====
 +Anzeigen der Konfiguration des Bootmanagers
 +  grubby --info=ALL
 +
 +Eine Option zum Default-Kernel hinzufügen (hier: SELinux ausschalten)
 +  grubby --args="​enforcing=0"​ --update-kernel="​$(grubby --default-kernel)"​
 +
 +Optionen vom Default-Kernel entfernen (hier: Unterdrückung der Kernel-Meldungen ausschalten)
 +  grubby --remove-args="​rhgb quiet" --update-kernel="​$(grubby --default-kernel)"​
 +
 ===== grub ===== ===== grub =====
 ==== Grub in den MBR installieren ==== ==== Grub in den MBR installieren ====
Zeile 84: Zeile 119:
 oder oder
   grub   grub
 +  device (hd0) /dev/sda
   root (hd0,0)   root (hd0,0)
   setup (hd0)   setup (hd0)
Zeile 94: Zeile 130:
 oder oder
   grub   grub
 +  device (hd0) /dev/sda
   root (hd0,0)   root (hd0,0)
   setup (hd0)   setup (hd0)
Zeile 128: Zeile 165:
 ===== Dokus & Links ===== ===== Dokus & Links =====
   * http://​wiki.ubuntuusers.de/​grub_2/​konfiguration   * http://​wiki.ubuntuusers.de/​grub_2/​konfiguration
 +
lpi1/bootloader.txt · Zuletzt geändert: 2023/10/11 14:32 (Externe Bearbeitung)