Unix / Linux / Ubuntu Forum

Ask Question   UnAnswered
Home » Forum » Unix / Linux / Ubuntu       RSS Feeds

Changing permissions on all files in a folder.

  Date: Jan 21    Category: Unix / Linux / Ubuntu    Views: 450

Ive tried to do this with out the command line but...

In one of the images/ folders I need to change the permissions on 2000
images from wadesmart/wadesmart to wadesmart/www-data.

I have a php script that will run against the images that needs the
group to be www-data.

The Octal Permissions are 100664 and the permissions are -rw-rw-r--.

Before attempting this I wanted to check to see if this is right:

cd to the folder.
sudo chmod 664 -R



4 Answers Found

Answer #1    Answered On: Jan 21    

Two points - you need the -R *before* the 664 and even if you're in the
folder you want to change, you need to tell it what to chmod, so you
need to cd to the directory and 'chmod -R 664 .' or 'chmod 664 *' should
work as well if there are no sub-folders - you don't need the 'sudo' if
the files are all owned by the logged in user, presumably yourself.

Answer #2    Answered On: Jan 21    

Ok. I screwed up in what I was asking.

I need to change the group to www-data from abc.

How do I also change the group?

Answer #3    Answered On: Jan 21    

I reading this page on File Permissions:

suds chown www-data abc

But Im not getting - does this do all the files in a folder?
Its not recursive?

Answer #4    Answered On: Jan 21    

You need the -R (for recursive) option: chown -R www-date wadesmart
chown, chmod, chgrp all work the same

Didn't find what you were looking for? Find more on Changing permissions on all files in a folder. Or get search suggestion and latest updates.