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 ...
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 ...
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 ...
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 ...
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, ...
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 ...
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 ...
Community wiki
14
votes
Accepted
Bash File/Folder Permission Issue on Windows 10
Workaround is add
umask 022
to .bashrc or similar.
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 ...
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.
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 ...
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/
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 ...
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&...
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 ...
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
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 ...
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. ...
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 ...
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 {} \;
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.
5
votes
chown -R exclude some directory
chown -R admin $(ls -I content)
ls -I will list all except specified pattern.
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' ...
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.
...
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 ...
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.
...
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 ...
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" ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
chmod × 324linux × 156
permissions × 128
chown × 46
macos × 41
ubuntu × 39
unix × 33
file-permissions × 32
bash × 20
windows × 11
mac × 11
ssh × 9
debian × 9
cygwin × 9
command-line × 8
security × 8
sudo × 8
root × 8
terminal × 7
apache-http-server × 7
centos × 7
find × 7
sftp × 7
acl × 7
filesystems × 6