How can I change the directory I am currently in and all directories under it to 755?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
Originally posted by abefroman 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
I wanted to do the same before, see this thread for a few solutions (a recursive script, and a crafty find command).
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.