Skip to main content
332 votes
Accepted

Linux - How to recursively chmod a folder?

Please refer to the manual (man chmod): -R, --recursive change files and directories recursively chmod -R 755 /path/to/directory would perform what you want. However… You don't usually want to 755 ...
slhck's user avatar
  • 230k
76 votes
Accepted

Do I really need recursive chmod to restrict access to a folder?

For a directory, "read" access lets you list the contents, and "execute" access lets your traverse the directory to open one of its children (file or subdirectory). So if you remove: just the read ...
xenoid's user avatar
  • 10.2k
48 votes

Linux - How to recursively chmod a folder?

For a PHP-based web site, many sources like this one recommend 755 for directories and 644 for files. If you are in the DocumentRoot of the website, you can set this as follows: find . -type d -exec ...
Evan Donovan's user avatar
46 votes

Do I really need recursive chmod to restrict access to a folder?

It goes without saying that, if you created a file two days ago (with a publicly readable mode), and somebody read the file yesterday, or made a copy of it, then there’s nothing you can do today to ...
G-Man Says 'Reinstate Monica''s user avatar
33 votes

How to fix 'The application "..." can't be opened' on Mac?

In my case nothing helped until I accidently opened context menu on .zip file. Open With -> there were 1) Archive Utility (default) which always broke my app when unzipped 2) The Unarchiver, ...
Dmitriy Pavlukhin's user avatar
29 votes

How to fix 'The application "..." can't be opened' on Mac?

This happens because the application doesn't have execution permissions. To make the application executable: Open a terminal window (CMD + Space -> terminal); Using the cd command, navigate to the ...
Fanatique's user avatar
  • 4,918
28 votes
Accepted

Unable to write to /tmp directory in macOS, unable to correct permissions: “Operation not permitted”

Reboot your Mac into recovery mode Open Utilities menu in the top bar > open Terminal csrutil disable Reboot Remove the tmp folder sudo rm -i /tmp sudo rm -i /private/tmp Create tmp folder sudo ...
14 votes
Accepted

Bash File/Folder Permission Issue on Windows 10

Workaround is add umask 022 to .bashrc or similar.
mkocubinski's user avatar
12 votes

How to tell chmod to follow symbolic links?

For Linux/GNU see the second paragraph of the info page also on the Web, emphasis added: chmod never changes the permissions of symbolic links, since the chmod system call cannot change their ...
dave_thompson_085's user avatar
11 votes

Unable to write to /tmp directory in macOS, unable to correct permissions: “Operation not permitted”

sudo chmod 1777 /private/tmp Did it for me.
Renetik's user avatar
  • 213
9 votes

Setting differing ACLs on directories and files

For future readers, to use setfacl on existing files/folders without adding the executable bit to your files, the solution is this part of @Mikel's answer: My version of setfacl allows X exactly ...
Erik Koopmans's user avatar
8 votes

How to chmod +x a file in Windows, for use in Linux?

git update-index --chmod=+x myfile.sh from https://www.scivision.dev/git-windows-chmod-executable/
qxo's user avatar
  • 181
8 votes

How to recursively chmod all directories except files?

To recursively give directories read&execute privileges: find /path/to/base/dir -type d -exec chmod 755 {} \; To recursively give files read privileges: find /path/to/base/dir -type f -exec ...
Peter K's user avatar
  • 389
8 votes
Accepted

Can't clear ACL on macOS file - Operation not permitted

I found an answer to my own question. I don't know if this is new to macOS 11 Big Sur. I had to go to System Preferences → Security & Privacy → the Privacy tab. Then select "Full Disk Access&...
Rob N's user avatar
  • 231
7 votes

How to chmod all folders recursively excluding all folders within a specific folder?

After some playing around, I found that the following worked for me: chmod all files recursively excluding files: find . -not -path "*/node_modules*" -type f -exec chmod 644 {} \; chmod all ...
Kraang Prime's user avatar
7 votes

Linux - How to recursively chmod a folder?

If you wish to apply chmod to a specific directory/ file you can make use of find as following: find . -type f -name "*.sh" -print0 |xargs -0 chmod 755
Vishrant's user avatar
  • 257
6 votes
Accepted

How does bash make a file executable?

The "architecture" of the file doesn't change – it's up to you to make sure it has a correct format. That is, the file already needs to be a valid ELF binary, or a script with a valid #! header, or ...
grawity_u1686's user avatar
6 votes

chown -R exclude some directory

In Linux the most general tool to do something to files meeting some criteria is find. Few other answers base on the find … | xargs … idea, which is robust only if it uses null-terminated strings. ...
Kamil Maciorowski's user avatar
6 votes
Accepted

MacOS switched root Mongodb data folder to system ownership and it cannot be changed back anymore

I found out the reason for this nonsense. It's Apple. Basically, what is happening here is that the new version of MacOS, which is Catalina, now has System root folder as read only. So any software ...
Dom Berk's user avatar
5 votes
Accepted

How to chmod all folders recursively excluding all folders within a specific folder?

Remove -print, escape ( and ) and add space after {} find . -type d \( -path ./node_modules \) -prune -o -exec chmod 644 {} \;
Alex's user avatar
  • 6,255
5 votes

Equivalent of chmod to change file permissions in Windows

For me, the workaround is to install Cygwin, and add its bin folder to system path. Then, if you run "chmod" in command line, it will work. Although I have not verified its correctness.
WHOIF's user avatar
  • 51
5 votes

chown -R exclude some directory

chown -R admin $(ls -I content) ls -I will list all except specified pattern.
Ashark's user avatar
  • 3,818
5 votes

Is setting CHMOD to 777 Dangerous?

Each '7' in 777 means 'read'+'write'+'execute'. First digit defines permissions for file ouwner, second digit is for group and last digit for everyone 'other'. Let's assume the file belongs to 'root' ...
John Doe's user avatar
  • 151
4 votes
Accepted

Change permissions symbolic link Mac OS

After I went totally the wrong direction with this problem, allow me to restate the issue involved. Let's look at why symbolic link permissions are meaningless, so changing them or not isn't useful. ...
creidhne's user avatar
  • 1,910
4 votes

Ubuntu: default access mode (permissions) for users home dir (/home/user)

Note : Don't change the UMASK value in /etc/login.defs if you want to change the home directory permissions only. Cause changing the UMASK will affect everything. I once followed the same and when i ...
Abhishek Meena's user avatar
4 votes
Accepted

Is copying files from Windows to Cygwin harmful?

You would not be corrupting Cygwin if you copied files to /home. But you might prefer to let Cygwin put you in /home/{yourusername} and then create symlinks to your Windows' Documents, Pictures, etc. ...
Chris Davies's user avatar
  • 4,058
4 votes

launch transmission-daemon as root

transmission-daemon does not use the USER variable in /etc/init.d/transmission-daemon if your system is using systemd. systemd is telling the transmission-daemon to run as the debian-transmission ...
Deltik's user avatar
  • 19.7k
4 votes

How to fix 'The application "..." can't be opened' on Mac?

@Fanatique is right, but be advised - There are many possible causes for this problem, and most cannot be fixed using chmod. Handling program bundles with inappropriate tools often will "damage" ...
jvb's user avatar
  • 3,188
4 votes
Accepted

Can't Make an *.AppImage file Executable

This file is on an NTFS partition / filesystem (Windows-specific), which cannot support Unix-like permissions. This is why you are unable to set the execute-bit, which is specific to Unix. The best ...
Attie's user avatar
  • 20.2k
4 votes
Accepted

What to do when you remove permission for all users with chmod?

Since you only removed write & execute permission for files in your home directory, and it looks like there's no recursive option, so none of the contents of sub directories were affected, but you ...
Xen2050's user avatar
  • 14.1k

Only top scored, non community-wiki answers of a minimum length are eligible