admin_grundlagen:symbolische_links
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.
| Beide Seiten, vorherige ÜberarbeitungVorherige ÜberarbeitungNächste Überarbeitung | Vorherige Überarbeitung | ||
| admin_grundlagen:symbolische_links [2016/01/14 11:09] – [verwaiste Symlinks finden] ingo_wichmann | admin_grundlagen:symbolische_links [2022/07/19 12:29] (aktuell) – Externe Bearbeitung 127.0.0.1 | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| - | ===== Symbolische Links ===== | + | ====== Symbolische Links ====== |
| + | ===== Grundlegende Beispiele ===== | ||
| + | cp /etc/passwd . | ||
| ln -s passwd passwd-symlink | ln -s passwd passwd-symlink | ||
| ls -li passwd* | ls -li passwd* | ||
| Zeile 6: | Zeile 8: | ||
| Übungen 6.22 - 6.24 | Übungen 6.22 - 6.24 | ||
| - | | + | === Übung: cp -a vs. cp -r === |
| - | find doc -printf ' | + | |
| - | rm -r doc | + | find doc-r -printf ' |
| - | cp -a / | + | cp -a / |
| - | find doc -printf ' | + | find doc-a -printf ' |
| - | Übrig gebliebene | + | Unterschiede? |
| - | find / -xdev -uid 1002 -print0 | xargs -0 chown --no-dereference root | + | |
| + | ===== Wo befinden sich auf meinem System Symlinks? ==== | ||
| + | find / -xdev -type l -ls | ||
| + | find / -xdev -type l -printf ' | ||
| + | |||
| + | ===== Probleme mit Symlinks ===== | ||
| + | |||
| + | Symlinks werden von machen Entwicklern als problematisch gesehen: https:// | ||
| + | |||
| + | ==== Übrig gebliebene | ||
| + | find / -xdev -uid 1002 -exec chown --no-dereference root {} + | ||
| ==== verwaiste Symlinks finden ==== | ==== verwaiste Symlinks finden ==== | ||
| - | find | + | find -L . -type l -ls |
| + | |||
| + | ==== Link-Schleife ==== | ||
| + | ln -s a b | ||
| + | ln -s b a | ||
| + | # Es geht noch kürzer: ln -s a a | ||
| + | |||
| + | cat a | ||
| + | ==== Beispiel: Symlink-Attacke ==== | ||
| + | Funktioniert nur, wenn '' | ||
| + | sysctl fs.protected_symlinks | ||
| + | -> '' | ||
| + | |||
| + | Als root: | ||
| + | echo ' | ||
| + | echo '* * * * * echo "you are lost" > / | ||
| + | |||
| + | Als nutzer: | ||
| + | ln -s / | ||
| + | |||
| + | Um 9:58 wird root per cron die Datei ''/ | ||
| + | |||
| + | ==== Beispiel: protected_symlinks ==== | ||
| + | Funktioniert nur, wenn '' | ||
| + | sysctl fs.protected_symlinks | ||
| + | -> '' | ||
| + | mkdir -m 1777 offen.d/ | ||
| + | cd offen.d/ | ||
| + | touch datei | ||
| + | ln -s datei symlink | ||
| + | sudo chown --no-dereference nobody symlink | ||
| + | cat symlink | ||
| + | -> '' | ||
| + | ==== Dokus und Links ==== | ||
| + | * https:// | ||
| + | * https:// | ||
admin_grundlagen/symbolische_links.1452769783.txt.gz · Zuletzt geändert: 2016/01/14 11:09 von ingo_wichmann
