Omit the *
after xargs chown
because it will try to add the list of all file names twice twice (once from ls
and then again from *
).
Try
chown -R apache:apache .
This changes the current folder (.
) and everything in it and always works. If you need different permissions for the folder itself, write them down and restore them afterwards using chown
without -R
.
If you really want to process only the contents of the folder, this will work:
find . -maxdepth 1 -not -name "." -print0 | xargs --null chown -R apache:apache