Hot answers tagged

302 votes

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
  • 226k
76 votes

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
  • 9,862
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
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 ...
Evan Donovan's user avatar
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, ...
Dmitriy Pavlukhin's user avatar
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 ...
Fanatique's user avatar
  • 4,588
27 votes

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 ...
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 ...
Angelo Turetta's user avatar
14 votes

Bash File/Folder Permission Issue on Windows 10

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

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 ...
Steven's user avatar
  • 27.7k
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 ...
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

cygwin's chmod behaves as working, but it does not work

Kudos to this answer contents pasted below You are probably using NTFS or FAT32 on Windows, and those ...
crowne's user avatar
  • 245
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.
Marco Lackovic's user avatar
8 votes

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

git update-index --chmod=+x from
qxo's user avatar
  • 181
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 ...
Erik Koopmans's user avatar
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 ...
Peter K's user avatar
  • 369
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
  • 247
6 votes

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 ...
u1686_grawity's user avatar
6 votes

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
6 votes

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
  • 211
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,628
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

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

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,844
4 votes

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,187
4 votes

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
  • 3,121
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.5k

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