fix: Backup-Snapshots werden jetzt mit sudo erstellt fuer korrekte Berechtigungen

Problem:
  Backups wurden ohne Root-Rechte erstellt. Dadurch wurden Datei-
  berechtigungen (UID/GID, rwx, ACLs, xattrs) nicht korrekt uebernommen.
  Root-Dateien konnten nicht gelesen werden. Backups waren unvollstaendig.

Loesung:
  - rsync_manager: create_snapshot() nutzt jetzt sudo fuer rsync
  - rsync_manager: --numeric-ids Flag hinzugefuegt fuer korrekte UID/GID
  - snapshot_manager: mkdir mit sudo fuer Root-Besitz der Snapshots
  - snapshot_manager: delete_snapshot mit sudo (Snapshots sind Root-owned)
  - main_window: Sudo-Passwort-Dialog vor jedem Backup
  - main_window: Dialog-Text erweitert (Backup erfordert sudo)
  - main.cpp: --sudo-password Argument fuer CLI/Cron-Modus
  - main.cpp: Interaktive Passwort-Eingabe im CLI-Modus
  - README.md: Build-Abhaengigkeiten fuer alle Distros hinzugefuegt
  - README.md: Rechte-Tabelle aktualisiert
  - README.md: Cronjob-Beispiel mit Passwort-Speicherung aktualisiert

Betroffene Dateien:
  src/rsync_manager.h, src/rsync_manager.cpp
  src/snapshot_manager.h, src/snapshot_manager.cpp
  src/main_window.h, src/main_window.cpp
  src/main.cpp
  README.md
This commit is contained in:
x3
2026-09-08 08:17:39 +00:00
parent f95a634655
commit 240071166e
8 changed files with 137 additions and 39 deletions
+14 -9
View File
@@ -673,7 +673,9 @@ void MainWindow::show_sudo_dialog(std::function<void(const std::string&)> callba
GtkWidget* icon = gtk_image_new_from_icon_name("dialog-password", GTK_ICON_SIZE_DIALOG);
gtk_box_pack_start(GTK_BOX(box), icon, FALSE, FALSE, 0);
GtkWidget* label = gtk_label_new("Root access is required to restore files.\nEnter your sudo password:");
GtkWidget* label = gtk_label_new("Root access is required to preserve file permissions.\n"
"Backups will be created with sudo to ensure correct ownership and permissions.\n\n"
"Enter your sudo password:");
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0);
@@ -689,6 +691,7 @@ void MainWindow::show_sudo_dialog(std::function<void(const std::string&)> callba
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
const char* pw = gtk_entry_get_text(GTK_ENTRY(pass_entry));
if (pw && *pw) {
current_sudo_password_ = std::string(pw);
callback(std::string(pw));
}
}
@@ -874,15 +877,17 @@ void MainWindow::append_backup_line(const std::string& line, const char* tag) {
void MainWindow::on_backup(GtkWidget*, gpointer d) {
auto* self = static_cast<MainWindow*>(d);
self->tray_.set_status("x3-Backup - Creating backup...", true);
self->open_backup_window("Creating Snapshot...");
gtk_label_set_text(GTK_LABEL(self->live_log_label_), "Backup running...");
self->show_sudo_dialog([self](const std::string& pw) {
self->tray_.set_status("x3-Backup - Creating backup...", true);
self->open_backup_window("Creating Snapshot...");
gtk_label_set_text(GTK_LABEL(self->live_log_label_), "Backup running...");
g_thread_new("backup", [](gpointer data) -> gpointer {
auto* s = static_cast<MainWindow*>(data);
s->snapshots_.create_snapshot();
return nullptr;
}, self);
g_thread_new("backup", [](gpointer data) -> gpointer {
auto* s = static_cast<MainWindow*>(data);
s->snapshots_.create_snapshot("", s->current_sudo_password_);
return nullptr;
}, self);
});
}
void MainWindow::start_quick_backup() {