Change ownership or permissions on only directories or files, recursively
I’m trying to set permissions/ownership on either directories or files, recursively within a given directory, without changing the other.
E.g. I have directory /web where I want to set all the directories to 775, but the files to 664.
Is there a way to do this easily?
For files:
$ find /path/to/directory -type f -print0 | xargs -0 chmod 664
For directories:
$ find /path/to/directory -type d -print0 | xargs -0 chmod 775
Check more discussion of this question.
Related posts:
- Find and delete all but N largest files in 100s of directories
- Change user permissions on files/directories where user = fred recursively
- chmod all files (including hidden files) in a directory in Linux (not recursively)
- How to make apache create files with certain permissions?
- how to change permissions of specific file type
Leave a comment
Recent Posts
- Understanding redundant power supplies
- Is there a way for administrators to disable users from installing Firefox extensions?
- Is there research material on NTP accuracy available?
- How to create a limited “domain admin” that does not have access to domain controllers?
- Can Windows RDC admin users be immune from being kicked?
Tags
active-directory
amazon-ec2
apache
apache2
backup
bash
centos
cisco
command-line
debian
dns
email
exchange
firewall
iis
iis7
iptables
linux
macosx
monitoring
mysql
networking
nginx
performance
permissions
php
postfix
raid
security
sql-server
sql-server-2005
sql-server-2008
ssh
ssl
ubuntu
unix
virtualization
vpn
webserver
windows
windows-7
windows-server-2003
windows-server-2008
windows-server-2008-r2
windows-xp





