302
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 ...
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 ...
40
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 ...
31
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, ...
28
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 ...
27
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
18
votes
Creating files and directories with a certain owner (user/group) while sudoing
There is another way, quite elegant I think. Using install(1)
For example, zabbix-agentd needs a subfolder inside /var/run, but recent distributions are using tmpfs for /var/run, so the directory ...
14
votes
Accepted
Bash File/Folder Permission Issue on Windows 10
Workaround is add
umask 022
to .bashrc or similar.
13
votes
Accepted
SUID bit on directories
GNU Coreutils: Directory Setuid and Setgid
27.5 Directories and the Set-User-ID and Set-Group-ID Bits
On most systems, if a directory’s set-group-ID bit is set, newly
created subfiles ...
11
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
cygwin's chmod behaves as working, but it does not work
Kudos to this answer https://stackoverflow.com/questions/25730041/updating-file-permissions-with-git-bash-on-windows-7 contents pasted below
You are probably using NTFS or FAT32 on Windows, and those ...
8
votes
icacls is giving access denied on remote file system
Run Windows Command Prompt as administrator and then run:
takeown /R /F file1.txt
icacls file1.txt /t /c /GRANT Everyone:F
It works with folders as well.
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
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 ...
7
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 ...
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
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 ...
6
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&...
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
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
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
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 {} \;
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
chmod × 322linux × 155
permissions × 128
chown × 45
macos × 41
ubuntu × 38
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
centos × 7
apache-http-server × 7
find × 7
acl × 7
filesystems × 6
ftp × 6