Linux/chmod recursively

Aus Ringo's Wiki
Zur Navigation springen Zur Suche springen

Um Rekursiv die Rechte zu ändern kann man folgendes tun:

  • find /path/to/base/dir -type d -exec chmod 755 {} +
  • find /path/to/base/dir -type f -exec chmod 644 {} +

oder

  • chmod 755 $(find /path/to/base/dir -type d)
  • chmod 644 $(find /path/to/base/dir -type f)

oder um das chmod spawning zu reduzieren

  • find /path/to/base/dir -type d -print0 | xargs -0 chmod 755
  • find /path/to/base/dir -type f -print0 | xargs -0 chmod 644