How can I change the directory I am currently in and all directories under it to 755?
How can I change the directory I am currently in and all directories under it to 755? Currently they are 775
|
chmod -R 0755 /path/to/rootfolder
|
Hi,
cd .. chmod -R 755 <directory you where previously in> If the directories are actually changed from 775 to 755 depends on who's owner of those directories and who's executing the chmod command. root is the only user which does not have this restriction. man chmod for more details. Hope this helps. |
Wont that change all directories and files? I am trying to do directories only? (leave the files as 644)
WHat is the difference between chmod -R 0755 /path/to/rootfolder and chmod -R 755 /path/to/rootfolder |
Quote:
Make sure you read the whole thread to get the right script. I love the idea of using 'echo chmod permissions file' to echo what will actually happens before running it. You should do this first to simulate that everything will work as expected. Or just use the find command :p |
That's correct, files and dirs are changed.
There's no option in chmod that can do this, you could use find: find . -type d -exec chmod 755 {} \; The above will changes dirs only (-type d). There is no difference between 0755 and 755. The first number (0) is for setting sticky bit(s) and can be ignored for 'normal' modifications. See man chmod for details. Hope this helps. |
If this is your home directory that you are talking about, be careful when using chmod on hidden directories such as .kde. Sometimes a subdirectory will have a different group owner that needs write access to function normally. Also, if you have a ~/tmp directory or a tmp directory in .kde or .gnome, these directories might on your system serve a similar function as the main /tmp directory for a number of services which run as a psuedo user.
Suppose that your default user is users. You could restrict find result with the "-group users" predicate. This should make the command safer by restricting the change to directories with your default gname. |
All times are GMT -5. The time now is 12:14 AM. |